marko 4.26.5 → 4.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/CHANGELOG.md +2510 -0
  2. package/README.md +1 -1
  3. package/bin/markoc.js +15 -15
  4. package/dist/compiler/CompileContext.js +1 -0
  5. package/dist/compiler/ast/CustomTag.js +2 -2
  6. package/dist/core-tags/components/TransformHelper/convertToComponent.js +1 -1
  7. package/dist/core-tags/components/TransformHelper/handleLegacyBind.js +0 -4
  8. package/dist/core-tags/core/await/renderer.js +0 -4
  9. package/dist/core-tags/migrate/all-tags/body-only-if.js +0 -1
  10. package/dist/core-tags/migrate/all-tags/control-flow-directives.js +0 -1
  11. package/dist/core-tags/migrate/all-tags/dynamic-attributes.js +1 -2
  12. package/dist/core-tags/migrate/all-tags/include-directive.js +0 -2
  13. package/dist/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -2
  14. package/dist/core-tags/migrate/all-tags/marko-init.js +0 -2
  15. package/dist/core-tags/migrate/all-tags/modifier-key.js +0 -2
  16. package/dist/core-tags/migrate/all-tags/ref.js +1 -3
  17. package/dist/core-tags/migrate/all-tags/w-bind.js +0 -2
  18. package/dist/core-tags/migrate/all-tags/w-body.js +0 -2
  19. package/dist/core-tags/migrate/all-tags/w-config.js +0 -2
  20. package/dist/core-tags/migrate/all-tags/w-for.js +0 -3
  21. package/dist/core-tags/migrate/all-tags/w-id.js +1 -4
  22. package/dist/core-tags/migrate/all-tags/w-on.js +1 -4
  23. package/dist/core-tags/migrate/all-tags/w-preserve-attrs.js +0 -2
  24. package/dist/core-tags/migrate/all-tags/w-preserve.js +1 -3
  25. package/dist/core-tags/migrate/all-tags/widget-in-attrs.js +2 -11
  26. package/dist/core-tags/migrate/all-templates/non-standard-template-literals.js +0 -4
  27. package/dist/core-tags/migrate/all-templates/render-calls.js +0 -2
  28. package/dist/core-tags/migrate/assign-tag.js +0 -2
  29. package/dist/core-tags/migrate/async-fragment-tag.js +0 -2
  30. package/dist/core-tags/migrate/async-fragments-tag.js +0 -2
  31. package/dist/core-tags/migrate/await-tag.js +0 -7
  32. package/dist/core-tags/migrate/class-tag.js +0 -2
  33. package/dist/core-tags/migrate/component-globals-tag.js +0 -2
  34. package/dist/core-tags/migrate/for-tag.js +0 -2
  35. package/dist/core-tags/migrate/include-tag.js +0 -1
  36. package/dist/core-tags/migrate/invoke-tag.js +0 -2
  37. package/dist/core-tags/migrate/layout-placeholder-tag.js +0 -1
  38. package/dist/core-tags/migrate/layout-put-tag.js +0 -1
  39. package/dist/core-tags/migrate/layout-use-tag.js +0 -1
  40. package/dist/core-tags/migrate/macro-body-tag.js +0 -2
  41. package/dist/core-tags/migrate/macro-tag.js +0 -2
  42. package/dist/core-tags/migrate/unless-tag.js +0 -1
  43. package/dist/core-tags/migrate/var-tag.js +0 -2
  44. package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -10
  45. package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -4
  46. package/dist/node_modules/@internal/components-registry/index-browser.js +2 -0
  47. package/dist/runtime/RenderResult.js +0 -3
  48. package/dist/runtime/components/Component.js +0 -6
  49. package/dist/runtime/components/ComponentDef.js +0 -3
  50. package/dist/runtime/components/ServerComponent.js +0 -4
  51. package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -3
  52. package/dist/runtime/components/legacy/defineRenderer-legacy.js +0 -6
  53. package/dist/runtime/components/legacy/index.js +3 -1
  54. package/dist/runtime/helpers/dynamic-tag.js +3 -0
  55. package/dist/runtime/helpers/for-of.js +3 -1
  56. package/dist/runtime/helpers/interop-require.js +3 -0
  57. package/dist/runtime/html/helpers/attr.js +0 -4
  58. package/dist/runtime/html/helpers/attrs.js +0 -2
  59. package/dist/runtime/html/helpers/merge-attrs.js +0 -3
  60. package/dist/runtime/vdom/VElement.js +0 -3
  61. package/dist/runtime/vdom/helpers/attrs.js +0 -2
  62. package/dist/taglib/taglib-finder/index.js +1 -1
  63. package/dist/taglib/taglib-loader/Taglib.js +2 -1
  64. package/dist/taglib/taglib-loader/index.js +2 -2
  65. package/dist/taglib/taglib-loader/loadTagFromProps.js +15 -0
  66. package/dist/taglib/taglib-loader/loadTaglibFromFile.js +2 -2
  67. package/dist/taglib/taglib-loader/loadTaglibFromProps.js +12 -0
  68. package/docs/10-awesome-marko-features.md +1 -1
  69. package/docs/body-content.md +3 -3
  70. package/docs/class-components.md +6 -6
  71. package/docs/express.md +1 -1
  72. package/docs/fastify.md +4 -4
  73. package/docs/hapi.md +3 -3
  74. package/docs/http.md +1 -1
  75. package/docs/huncwot.md +1 -1
  76. package/docs/installing.md +2 -2
  77. package/docs/koa.md +2 -2
  78. package/docs/lasso.md +1 -1
  79. package/docs/marko-4-upgrade.md +1 -1
  80. package/docs/marko-v4.md +4 -4
  81. package/docs/marko-vs-react.md +2 -2
  82. package/docs/rendering.md +6 -6
  83. package/docs/server-side-rendering.md +3 -3
  84. package/docs/webpack.md +16 -16
  85. package/docs/why-is-marko-fast.md +3 -3
  86. package/package.json +1 -2
  87. package/src/compiler/Builder.js +13 -13
  88. package/src/compiler/CodeGenerator.js +2 -2
  89. package/src/compiler/CodeWriter.js +1 -1
  90. package/src/compiler/CompileContext.js +31 -30
  91. package/src/compiler/Compiler.js +3 -3
  92. package/src/compiler/HtmlJsParser.js +4 -4
  93. package/src/compiler/Migrator.js +2 -2
  94. package/src/compiler/Normalizer.js +5 -5
  95. package/src/compiler/Parser.js +11 -11
  96. package/src/compiler/Walker.js +1 -1
  97. package/src/compiler/ast/ArrayExpression.js +1 -1
  98. package/src/compiler/ast/BinaryExpression.js +1 -1
  99. package/src/compiler/ast/ConditionalExpression.js +1 -1
  100. package/src/compiler/ast/CustomTag.js +14 -14
  101. package/src/compiler/ast/Declaration.js +2 -2
  102. package/src/compiler/ast/DocumentType.js +2 -2
  103. package/src/compiler/ast/ForEach.js +1 -1
  104. package/src/compiler/ast/ForEachProp.js +1 -1
  105. package/src/compiler/ast/ForRange.js +1 -1
  106. package/src/compiler/ast/HtmlAttribute/html/generateCode.js +4 -4
  107. package/src/compiler/ast/HtmlAttribute/vdom/generateCode.js +2 -2
  108. package/src/compiler/ast/HtmlAttributeCollection.js +3 -3
  109. package/src/compiler/ast/HtmlComment.js +1 -1
  110. package/src/compiler/ast/HtmlElement/html/EndTag.js +1 -1
  111. package/src/compiler/ast/HtmlElement/html/StartTag.js +3 -3
  112. package/src/compiler/ast/HtmlElement/html/generateCode.js +5 -5
  113. package/src/compiler/ast/HtmlElement/index.js +1 -1
  114. package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
  115. package/src/compiler/ast/HtmlElement/vdom/generateCode.js +3 -3
  116. package/src/compiler/ast/If.js +1 -1
  117. package/src/compiler/ast/LogicalExpression.js +1 -1
  118. package/src/compiler/ast/MemberExpression.js +1 -1
  119. package/src/compiler/ast/NewExpression.js +1 -1
  120. package/src/compiler/ast/Node.js +4 -4
  121. package/src/compiler/ast/ObjectExpression.js +2 -2
  122. package/src/compiler/ast/Property.js +1 -1
  123. package/src/compiler/ast/SequenceExpression.js +1 -1
  124. package/src/compiler/ast/TemplateLiteral.js +1 -1
  125. package/src/compiler/ast/TemplateRoot.js +3 -3
  126. package/src/compiler/ast/Text/index.js +1 -1
  127. package/src/compiler/ast/UnaryExpression.js +1 -1
  128. package/src/compiler/ast/UpdateExpression.js +1 -1
  129. package/src/compiler/config.js +1 -1
  130. package/src/compiler/index.js +5 -5
  131. package/src/compiler/modules.js +2 -2
  132. package/src/compiler/util/UniqueVars.js +4 -4
  133. package/src/compiler/util/convertRawJavaScriptAst.js +1 -1
  134. package/src/compiler/util/javaScriptReservedWords.js +1 -1
  135. package/src/compiler/util/macros.js +1 -1
  136. package/src/compiler/util/mergeProps.js +3 -3
  137. package/src/compiler/util/parseJavaScriptArgs.js +1 -1
  138. package/src/compiler/util/parseJavaScriptParams.js +1 -1
  139. package/src/compiler/util/parseRawJavaScriptAst.js +1 -1
  140. package/src/compiler/util/removeComments.js +6 -6
  141. package/src/compiler/util/tokenizer.js +3 -3
  142. package/src/compiler/util/vdom/VDOMOptimizer.js +2 -2
  143. package/src/core-tags/cache/cached-fragment-tag.js +2 -2
  144. package/src/core-tags/cache/default-cache-manager.js +2 -2
  145. package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +3 -3
  146. package/src/core-tags/components/TransformHelper/assignComponentId.js +3 -3
  147. package/src/core-tags/components/TransformHelper/convertToComponent.js +7 -5
  148. package/src/core-tags/components/TransformHelper/getComponentFiles.js +1 -1
  149. package/src/core-tags/components/TransformHelper/handleComponentEvents.js +3 -3
  150. package/src/core-tags/components/TransformHelper/handleComponentPreserve.js +7 -7
  151. package/src/core-tags/components/TransformHelper/handleLegacyBind.js +2 -8
  152. package/src/core-tags/components/TransformHelper/handleRootNodes.js +14 -14
  153. package/src/core-tags/components/TransformHelper/handleScopedAttrs.js +1 -1
  154. package/src/core-tags/components/TransformHelper/index.js +1 -1
  155. package/src/core-tags/components/component-tag.js +1 -1
  156. package/src/core-tags/components/components-transformer.js +2 -2
  157. package/src/core-tags/components/util/generateRegisterComponentCode.js +2 -2
  158. package/src/core-tags/components/widget-types-tag.js +2 -2
  159. package/src/core-tags/core/await/AsyncValue.js +1 -1
  160. package/src/core-tags/core/await/renderer.js +3 -12
  161. package/src/core-tags/core/await/reorderer-renderer.js +1 -1
  162. package/src/core-tags/core/core-transformer.js +5 -5
  163. package/src/core-tags/core/html-comment-tag.js +1 -1
  164. package/src/core-tags/core/import-tag.js +1 -1
  165. package/src/core-tags/core/util/parseImport.js +8 -8
  166. package/src/core-tags/html/normalize-script-text.js +1 -1
  167. package/src/core-tags/migrate/all-tags/body-only-if.js +4 -5
  168. package/src/core-tags/migrate/all-tags/control-flow-directives.js +2 -5
  169. package/src/core-tags/migrate/all-tags/dynamic-attributes.js +1 -4
  170. package/src/core-tags/migrate/all-tags/include-directive.js +0 -4
  171. package/src/core-tags/migrate/all-tags/index.js +2 -2
  172. package/src/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -5
  173. package/src/core-tags/migrate/all-tags/marko-init.js +2 -8
  174. package/src/core-tags/migrate/all-tags/modifier-key.js +1 -7
  175. package/src/core-tags/migrate/all-tags/params.js +1 -1
  176. package/src/core-tags/migrate/all-tags/ref.js +1 -5
  177. package/src/core-tags/migrate/all-tags/w-bind.js +8 -12
  178. package/src/core-tags/migrate/all-tags/w-body.js +3 -7
  179. package/src/core-tags/migrate/all-tags/w-config.js +1 -5
  180. package/src/core-tags/migrate/all-tags/w-for.js +1 -8
  181. package/src/core-tags/migrate/all-tags/w-id.js +1 -8
  182. package/src/core-tags/migrate/all-tags/w-on.js +2 -9
  183. package/src/core-tags/migrate/all-tags/w-preserve-attrs.js +1 -5
  184. package/src/core-tags/migrate/all-tags/w-preserve.js +3 -7
  185. package/src/core-tags/migrate/all-tags/widget-in-attrs.js +4 -17
  186. package/src/core-tags/migrate/all-templates/index.js +2 -2
  187. package/src/core-tags/migrate/all-templates/non-standard-template-literals.js +6 -12
  188. package/src/core-tags/migrate/all-templates/render-calls.js +4 -8
  189. package/src/core-tags/migrate/all-templates/widget-data-is-state.js +2 -2
  190. package/src/core-tags/migrate/all-templates/widget-get-template-data.js +2 -2
  191. package/src/core-tags/migrate/assign-tag.js +2 -6
  192. package/src/core-tags/migrate/async-fragment-tag.js +2 -6
  193. package/src/core-tags/migrate/async-fragments-tag.js +0 -4
  194. package/src/core-tags/migrate/await-tag.js +8 -23
  195. package/src/core-tags/migrate/class-tag.js +0 -4
  196. package/src/core-tags/migrate/component-globals-tag.js +0 -4
  197. package/src/core-tags/migrate/for-tag.js +12 -16
  198. package/src/core-tags/migrate/include-tag.js +2 -5
  199. package/src/core-tags/migrate/invoke-tag.js +2 -6
  200. package/src/core-tags/migrate/layout-placeholder-tag.js +0 -3
  201. package/src/core-tags/migrate/layout-put-tag.js +0 -3
  202. package/src/core-tags/migrate/layout-use-tag.js +0 -3
  203. package/src/core-tags/migrate/macro-body-tag.js +0 -5
  204. package/src/core-tags/migrate/macro-tag.js +5 -10
  205. package/src/core-tags/migrate/unless-tag.js +0 -3
  206. package/src/core-tags/migrate/util/addIdScopedAttr.js +1 -1
  207. package/src/core-tags/migrate/util/import-tag.js +6 -6
  208. package/src/core-tags/migrate/util/parseFor.js +20 -20
  209. package/src/core-tags/migrate/util/renderCallToDynamicTag.js +7 -7
  210. package/src/core-tags/migrate/var-tag.js +4 -8
  211. package/src/express.js +1 -1
  212. package/src/hot-reload.js +3 -3
  213. package/src/node-require/index.js +1 -1
  214. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +2 -53
  215. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -10
  216. package/src/node_modules/@internal/components-registry/index-browser.js +2 -0
  217. package/src/runtime/RenderResult.js +3 -16
  218. package/src/runtime/components/Component.js +2 -23
  219. package/src/runtime/components/ComponentDef.js +2 -8
  220. package/src/runtime/components/ComponentsContext.js +1 -1
  221. package/src/runtime/components/ServerComponent.js +0 -6
  222. package/src/runtime/components/State.js +2 -2
  223. package/src/runtime/components/attach-detach.js +1 -1
  224. package/src/runtime/components/dom-data.js +1 -1
  225. package/src/runtime/components/legacy/defineComponent-legacy.js +0 -5
  226. package/src/runtime/components/legacy/defineRenderer-legacy.js +0 -16
  227. package/src/runtime/components/legacy/dependencies/index.js +10 -10
  228. package/src/runtime/components/legacy/index.js +5 -0
  229. package/src/runtime/components/legacy/renderer-legacy.js +1 -1
  230. package/src/runtime/components/update-manager.js +1 -1
  231. package/src/runtime/dom-insert.js +1 -1
  232. package/src/runtime/helpers/_weak-map.js +1 -1
  233. package/src/runtime/helpers/bind-component.js +1 -1
  234. package/src/runtime/helpers/dynamic-tag.js +3 -0
  235. package/src/runtime/helpers/for-of.js +1 -6
  236. package/src/runtime/helpers/interop-require.js +3 -0
  237. package/src/runtime/html/AsyncStream.js +5 -5
  238. package/src/runtime/html/BufferedWriter.js +1 -1
  239. package/src/runtime/html/StringWriter.js +1 -1
  240. package/src/runtime/html/helpers/attr.js +0 -9
  241. package/src/runtime/html/helpers/attrs.js +0 -6
  242. package/src/runtime/html/helpers/merge-attrs.js +0 -8
  243. package/src/runtime/html/index.js +1 -1
  244. package/src/runtime/renderable.js +1 -1
  245. package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
  246. package/src/runtime/vdom/VComment.js +1 -1
  247. package/src/runtime/vdom/VComponent.js +1 -1
  248. package/src/runtime/vdom/VDocumentFragment.js +1 -1
  249. package/src/runtime/vdom/VElement.js +4 -11
  250. package/src/runtime/vdom/VFragment.js +1 -1
  251. package/src/runtime/vdom/VNode.js +1 -1
  252. package/src/runtime/vdom/VText.js +1 -1
  253. package/src/runtime/vdom/helpers/attrs.js +0 -7
  254. package/src/runtime/vdom/index.js +1 -1
  255. package/src/runtime/vdom/morphdom/fragment.js +1 -1
  256. package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
  257. package/src/taglib/taglib-finder/index.js +6 -6
  258. package/src/taglib/taglib-loader/Tag.js +8 -8
  259. package/src/taglib/taglib-loader/Taglib.js +3 -2
  260. package/src/taglib/taglib-loader/index.js +2 -2
  261. package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
  262. package/src/taglib/taglib-loader/loadTagFromProps.js +29 -14
  263. package/src/taglib/taglib-loader/loadTaglibFromFile.js +2 -2
  264. package/src/taglib/taglib-loader/loadTaglibFromProps.js +27 -9
  265. package/src/taglib/taglib-loader/scanTagsDir.js +6 -6
  266. package/src/taglib/taglib-lookup/TaglibLookup.js +8 -8
@@ -2,20 +2,16 @@ const newTags = {
2
2
  "w-preserve": "no-update",
3
3
  "w-preserve-if": "no-update-if",
4
4
  "w-preserve-body": "no-update-body",
5
- "w-preserve-body-if": "no-update-body-if"
5
+ "w-preserve-body-if": "no-update-body-if",
6
6
  };
7
- module.exports = function migrate(el, context) {
8
- el.forEachAttribute(attr => {
7
+ module.exports = function migrate(el) {
8
+ el.forEachAttribute((attr) => {
9
9
  const name = attr.name;
10
10
  if (!name || !Object.keys(newTags).includes(name)) {
11
11
  return;
12
12
  }
13
13
 
14
14
  const newAttrName = newTags[name];
15
- context.deprecate(
16
- `The "${name}" attribute is deprecated. Please use "${newAttrName}" attribute instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`
17
- );
18
-
19
15
  attr.name = newAttrName;
20
16
  });
21
17
  };
@@ -1,5 +1,5 @@
1
1
  module.exports = function migrate(el, context) {
2
- el.forEachAttribute(attr => {
2
+ el.forEachAttribute((attr) => {
3
3
  const value = attr.value;
4
4
 
5
5
  if (
@@ -7,31 +7,18 @@ module.exports = function migrate(el, context) {
7
7
  el.tagName !== "var" &&
8
8
  el.tagName !== "assign"
9
9
  ) {
10
- context.deprecate(
11
- `The "*=widget.elId("someId")" is deprecated. Please use "*:scoped="someId"" modifier instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`
12
- );
13
-
14
10
  attr.name += ":scoped";
15
11
  attr.value = value.args[0];
16
12
  return;
17
13
  }
18
14
 
19
- let found;
20
- const walker = context.createWalker({
15
+ context.createWalker({
21
16
  enter(node) {
22
17
  if (isWidgetMemberExpression(node)) {
23
18
  node.object.name = "component";
24
- found = true;
25
19
  }
26
- }
27
- });
28
- walker.walk(value);
29
-
30
- if (found) {
31
- context.deprecate(
32
- `The "widget" variable is deprecated. Please use "component" instead.`
33
- );
34
- }
20
+ },
21
+ }).walk(value);
35
22
  });
36
23
  };
37
24
 
@@ -2,10 +2,10 @@ const commonMigrators = [
2
2
  require("./non-standard-template-literals"),
3
3
  require("./render-calls"),
4
4
  require("./widget-data-is-state"),
5
- require("./widget-get-template-data")
5
+ require("./widget-get-template-data"),
6
6
  ];
7
7
 
8
8
  module.exports = function (root, context) {
9
- commonMigrators.forEach(migrator => migrator(root, context));
9
+ commonMigrators.forEach((migrator) => migrator(root, context));
10
10
  return true;
11
11
  };
@@ -16,7 +16,7 @@ module.exports = function migrator(el, context) {
16
16
  } else {
17
17
  // For others we keep track of them to run an optional migration below.
18
18
  node._originalExpressions = node.expressions;
19
- node.expressions = node.expressions.map(expr =>
19
+ node.expressions = node.expressions.map((expr) =>
20
20
  builder.conditionalExpression(
21
21
  builder.binaryExpression(expr, "==", builder.literalNull()),
22
22
  builder.literal(""),
@@ -26,17 +26,11 @@ module.exports = function migrator(el, context) {
26
26
  literals.push(node);
27
27
  }
28
28
  }
29
- }
29
+ },
30
30
  });
31
31
 
32
32
  walker.walk(el);
33
33
 
34
- if (found) {
35
- context.deprecate(
36
- "Non standard template literals have been deprecated, please use javascript template literals instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-nonstandard-template-literals"
37
- );
38
- }
39
-
40
34
  if (literals.length) {
41
35
  context.addMigration({
42
36
  description: "Migrate template with non standard template literals",
@@ -46,16 +40,16 @@ module.exports = function migrator(el, context) {
46
40
  type: "confirm",
47
41
  message:
48
42
  "Non standard template literals convert null/undefined/false to empty strings, JavaScript template literals do not. If you are relying on this it may cause issues. Would you like to attempt to migrate?",
49
- initial: true
43
+ initial: true,
50
44
  })
51
- .then(shouldMigrate => {
45
+ .then((shouldMigrate) => {
52
46
  if (shouldMigrate) {
53
- literals.forEach(node => {
47
+ literals.forEach((node) => {
54
48
  node.expressions = node._originalExpressions;
55
49
  });
56
50
  }
57
51
  });
58
- }
52
+ },
59
53
  });
60
54
  }
61
55
  };
@@ -22,16 +22,12 @@ module.exports = function migrator(el, context) {
22
22
  return;
23
23
  }
24
24
 
25
- context.deprecate(
26
- "Directly rendering by passing `out` to a function is deprecated. Please use the dynamic tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-imperative-render-calls"
27
- );
28
-
29
25
  if (hasErrors) {
30
26
  return;
31
27
  }
32
28
 
33
29
  if (!replacement.type) {
34
- replacement.forEachChild(child => node.insertSiblingBefore(child));
30
+ replacement.forEachChild((child) => node.insertSiblingBefore(child));
35
31
  node.detach();
36
32
  } else {
37
33
  node.replaceWith(replacement);
@@ -41,14 +37,14 @@ module.exports = function migrator(el, context) {
41
37
  const builder = context.builder;
42
38
  if (!node.type) {
43
39
  if (node.replaceChild) {
44
- node.forEach(child => {
40
+ node.forEach((child) => {
45
41
  const replacement = replaceScriptlets(child, context);
46
42
  if (child !== replacement) {
47
43
  node.replaceChild(replacement, child);
48
44
  }
49
45
  });
50
46
  } else if (node.body) {
51
- node.body.forEach(child => {
47
+ node.body.forEach((child) => {
52
48
  const replacement = replaceScriptlets(child, context);
53
49
  if (child !== replacement) {
54
50
  node.body.replaceChild(replacement, child);
@@ -128,7 +124,7 @@ module.exports = function migrator(el, context) {
128
124
 
129
125
  return node;
130
126
  }
131
- }
127
+ },
132
128
  });
133
129
  walker.walk(el);
134
130
  };
@@ -8,9 +8,9 @@ module.exports = function migrator(el, context) {
8
8
  apply() {
9
9
  context.root.prependChild(
10
10
  context.builder.scriptlet({
11
- value: "var data = state"
11
+ value: "var data = state",
12
12
  })
13
13
  );
14
- }
14
+ },
15
15
  });
16
16
  };
@@ -7,9 +7,9 @@ module.exports = function migrator(el, context) {
7
7
  apply() {
8
8
  context.root.prependChild(
9
9
  context.builder.scriptlet({
10
- value: "var data = component.getTemplateData(state, input)"
10
+ value: "var data = component.getTemplateData(state, input)",
11
11
  })
12
12
  );
13
- }
13
+ },
14
14
  });
15
15
  };
@@ -7,10 +7,6 @@ module.exports = function migrator(elNode, context) {
7
7
  commonTagMigrator(elNode, context);
8
8
  elNode.setTransformerApplied(commonTagMigrator);
9
9
 
10
- context.deprecate(
11
- 'The "<assign>" tag is deprecated. Please use "$ <js_code>" for JavaScript in the template. See: https://github.com/marko-js/marko/wiki/Deprecation:-var,-assign,-invoke-tags'
12
- );
13
-
14
10
  if (!attributes) {
15
11
  context.addError(
16
12
  "Invalid <assign> tag. Argument is missing. Example; <assign x=123 />"
@@ -18,13 +14,13 @@ module.exports = function migrator(elNode, context) {
18
14
  return elNode;
19
15
  }
20
16
 
21
- elNode.attributes.forEach(attr => {
17
+ elNode.attributes.forEach((attr) => {
22
18
  elNode.insertSiblingBefore(
23
19
  builder.scriptlet({
24
20
  value:
25
21
  attr.value == null
26
22
  ? attr.name
27
- : `${attr.name} = ${printJS(attr.value, context, null, true)}`
23
+ : `${attr.name} = ${printJS(attr.value, context, null, true)}`,
28
24
  })
29
25
  );
30
26
  });
@@ -2,16 +2,12 @@ const awaitTagMigration = require("./await-tag");
2
2
  const newTags = {
3
3
  "async-fragment-placeholder": "await-placeholder",
4
4
  "async-fragment-timeout": "await-timeout",
5
- "async-fragment-error": "await-error"
5
+ "async-fragment-error": "await-error",
6
6
  };
7
7
  module.exports = function migrator(elNode, context) {
8
8
  const builder = context.builder;
9
9
  const attributes = elNode.attributes;
10
10
 
11
- context.deprecate(
12
- `The "<async-fragment>" tag is deprecated. Please use "<await>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-async-fragment`
13
- );
14
-
15
11
  if (!attributes || !attributes.length) {
16
12
  context.addError(
17
13
  'Invalid <async-fragment> tag. Argument is missing. Example; <async-fragment data-provider=data.userInfo var="userInfo" />'
@@ -34,7 +30,7 @@ module.exports = function migrator(elNode, context) {
34
30
  return;
35
31
  }
36
32
 
37
- elNode.forEachChild(child => {
33
+ elNode.forEachChild((child) => {
38
34
  const newTag = newTags[child.tagName];
39
35
  if (newTag) {
40
36
  child.tagName = newTag;
@@ -5,10 +5,6 @@ module.exports = function migrator(elNode, context) {
5
5
  commonTagMigrator(elNode, context);
6
6
  elNode.setTransformerApplied(commonTagMigrator);
7
7
 
8
- context.deprecate(
9
- `The "<async-fragments>" tag is deprecated. Please use "<await-reorderer>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-async-fragment`
10
- );
11
-
12
8
  // all this tag ever did was handling of client reordering
13
9
  // we'll remove the attribute as that's all this new tag does
14
10
  elNode.removeAttribute("client-reorder");
@@ -9,10 +9,6 @@ module.exports = function migrator(elNode, context) {
9
9
  return;
10
10
  }
11
11
 
12
- context.deprecate(
13
- 'The "<await(result from promise)>" syntax has been deprecated, please use the modern syntax of "<await(promise)><@then|result|>". See: https://github.com/marko-js/marko/wiki/Deprecation:-legacy-await'
14
- );
15
-
16
12
  elNode.argument = undefined;
17
13
  let provider = builder.expression(match[2]);
18
14
  const varName = match[1];
@@ -20,8 +16,8 @@ module.exports = function migrator(elNode, context) {
20
16
  const scopeExpression =
21
17
  elNode.getAttributeValue("scope") || (methodExpression ? provider : null);
22
18
  const argAssignments = elNode.attributes
23
- .filter(attr => attr.name && attr.name.startsWith("arg-"))
24
- .map(attr => {
19
+ .filter((attr) => attr.name && attr.name.startsWith("arg-"))
20
+ .map((attr) => {
25
21
  elNode.removeAttribute(attr.name);
26
22
  return [attr.name.slice(4), attr.value];
27
23
  });
@@ -50,14 +46,14 @@ module.exports = function migrator(elNode, context) {
50
46
  builder.scriptlet({
51
47
  value: printJS(
52
48
  builder.vars({
53
- arg: argExpression
49
+ arg: argExpression,
54
50
  }),
55
51
  context
56
- )
52
+ ),
57
53
  })
58
54
  );
59
55
 
60
- argAssignments.forEach(assignment => {
56
+ argAssignments.forEach((assignment) => {
61
57
  elNode.insertSiblingBefore(
62
58
  builder.scriptlet({
63
59
  value: printJS(
@@ -71,7 +67,7 @@ module.exports = function migrator(elNode, context) {
71
67
  "="
72
68
  ),
73
69
  context
74
- )
70
+ ),
75
71
  })
76
72
  );
77
73
  });
@@ -102,34 +98,23 @@ module.exports = function migrator(elNode, context) {
102
98
 
103
99
  let placeholderBody;
104
100
  if (elNode.hasAttribute("placeholder")) {
105
- context.deprecate(
106
- 'The "placeholder" attribute on the "<await>" tag is deprecated. Please use the "<@placeholder>" nested tag instead.'
107
- );
108
-
109
101
  placeholderBody = [builder.text(elNode.getAttributeValue("placeholder"))];
110
102
  elNode.removeAttribute("placeholder");
111
103
  }
112
104
 
113
105
  let timeoutBody;
114
106
  if (elNode.hasAttribute("timeout-message")) {
115
- context.deprecate(
116
- 'The "timeout-message" attribute on the "<await>" tag is deprecated. Please use the "<@catch|err|>" nested tag instead with a check for "err.name === "TimeoutError".'
117
- );
118
-
119
107
  timeoutBody = [builder.text(elNode.getAttributeValue("timeout-message"))];
120
108
  elNode.removeAttribute("timeout-message");
121
109
  }
122
110
 
123
111
  let errorBody;
124
112
  if (elNode.hasAttribute("error-message")) {
125
- context.deprecate(
126
- 'The "error-message" attribute on the "<await>" tag is deprecated. Please use the "<@catch>" nested tag instead.'
127
- );
128
113
  errorBody = [builder.text(elNode.getAttributeValue("error-message"))];
129
114
  elNode.removeAttribute("error-message");
130
115
  }
131
116
 
132
- elNode.forEachChild(childNode => {
117
+ elNode.forEachChild((childNode) => {
133
118
  if (childNode.type !== "HtmlElement") {
134
119
  return;
135
120
  }
@@ -202,7 +187,7 @@ module.exports = function migrator(elNode, context) {
202
187
  undefined,
203
188
  timeoutBody,
204
189
  'err.name === "TimeoutError"'
205
- )
190
+ ),
206
191
  ];
207
192
 
208
193
  if (originalErrorBody) {
@@ -11,9 +11,5 @@ module.exports = function migrator(el, context) {
11
11
  );
12
12
  }
13
13
 
14
- context.deprecate(
15
- "Having a named class at the top level of a file is deprecated. Use `class {...}` without a name instead."
16
- );
17
-
18
14
  el.tagString = el.tagString.replace(classNamedRegexp, "$1$2");
19
15
  };
@@ -1,7 +1,3 @@
1
1
  module.exports = function render(elNode, context) {
2
- context.deprecate(
3
- "The <component-globals> tag is deprecated. This functionality has been added to the '<init-components>' tag (which is automatically inserted at the end of the <body> tag), you can safely remove the '<component-globals>' tag."
4
- );
5
-
6
2
  elNode.detach();
7
3
  };
@@ -21,10 +21,6 @@ function migrateForLoop(elNode, context) {
21
21
  return;
22
22
  }
23
23
 
24
- context.deprecate(
25
- 'The "<for(...)>" syntax has been deprecated, checkout the modern syntax here: https://github.com/marko-js/marko/wiki/Deprecation:-legacy-for'
26
- );
27
-
28
24
  try {
29
25
  parsed = parseFor(elNode.argument);
30
26
  elNode.argument = undefined;
@@ -80,10 +76,10 @@ function migrateForLoop(elNode, context) {
80
76
  builder.variableDeclarator(
81
77
  iteratorResultName,
82
78
  builder.arrayExpression([])
83
- )
79
+ ),
84
80
  ]),
85
81
  context
86
- )
82
+ ),
87
83
  })
88
84
  );
89
85
 
@@ -102,12 +98,12 @@ function migrateForLoop(elNode, context) {
102
98
  builder.identifier("push")
103
99
  ),
104
100
  [itemName]
105
- )
101
+ ),
106
102
  ]
107
- )
103
+ ),
108
104
  ]),
109
105
  context
110
- )
106
+ ),
111
107
  })
112
108
  );
113
109
 
@@ -172,7 +168,7 @@ function migrateForLoop(elNode, context) {
172
168
  builder.memberExpression(parsed.in, parsed.nameVarName, true)
173
169
  ),
174
170
  context
175
- )
171
+ ),
176
172
  })
177
173
  );
178
174
 
@@ -208,7 +204,7 @@ function migrateForLoop(elNode, context) {
208
204
  elNode.insertSiblingBefore(
209
205
  builder.scriptlet({
210
206
  value: printJS(parsed.init, context),
211
- block: true
207
+ block: true,
212
208
  })
213
209
  );
214
210
  }
@@ -217,7 +213,7 @@ function migrateForLoop(elNode, context) {
217
213
  elNode.appendChild(
218
214
  builder.scriptlet({
219
215
  value: printJS(parsed.update, context),
220
- block: true
216
+ block: true,
221
217
  })
222
218
  );
223
219
  }
@@ -329,7 +325,7 @@ function normalizeParts(parsed, builder) {
329
325
  varName: varName,
330
326
  from: from,
331
327
  to: to,
332
- step: step
328
+ step: step,
333
329
  };
334
330
  }
335
331
 
@@ -354,7 +350,7 @@ function replaceStatusVarInBody(el, context, parsed) {
354
350
  indexIdentifier,
355
351
  "===",
356
352
  builder.binaryExpression(lengthIdentifier, "-", builder.literal(1))
357
- )
353
+ ),
358
354
  };
359
355
 
360
356
  const remapKeys = Object.keys(remaps);
@@ -373,7 +369,7 @@ function replaceStatusVarInBody(el, context, parsed) {
373
369
  `${statusVarName}\\.(${remapKeys.join("|")})\\(\\)`,
374
370
  "g"
375
371
  );
376
- const remapReplacer = str =>
372
+ const remapReplacer = (str) =>
377
373
  str.replace(remapRegexp, (_, key) => remapStrings[key]);
378
374
  const visitor = {
379
375
  enter(node) {
@@ -402,7 +398,7 @@ function replaceStatusVarInBody(el, context, parsed) {
402
398
  this.skip();
403
399
  }
404
400
  }
405
- }
401
+ },
406
402
  };
407
403
 
408
404
  context.createWalker(visitor).walk(el.body);
@@ -5,9 +5,6 @@ const commonTagMigrator = require("./all-tags");
5
5
  module.exports = function migrator(elNode, context) {
6
6
  commonTagMigrator(elNode, context);
7
7
  elNode.setTransformerApplied(commonTagMigrator);
8
- context.deprecate(
9
- 'The "<include>" tag is deprecated. Please use the "<${dynamic}/>" tag or regular text replacement instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-include-tag'
10
- );
11
8
 
12
9
  const builder = context.builder;
13
10
  const rawArg = elNode.argument;
@@ -53,8 +50,8 @@ module.exports = function migrator(elNode, context) {
53
50
  elNode.insertSiblingBefore(
54
51
  builder.scriptlet({
55
52
  value: builder.vars({
56
- [identifierName]: target
57
- })
53
+ [identifierName]: target,
54
+ }),
58
55
  })
59
56
  );
60
57
 
@@ -8,10 +8,6 @@ module.exports = function migrator(elNode, context) {
8
8
  const functionAttr = elNode.attributes[0];
9
9
  const functionArgs = functionAttr.argument;
10
10
 
11
- context.deprecate(
12
- 'The "<invoke>" tag is deprecated. Please use "$ <js_code>" for JavaScript in the template. See: https://github.com/marko-js/marko/wiki/Deprecation:-var,-assign,-invoke-tags'
13
- );
14
-
15
11
  if (!functionAttr) {
16
12
  context.addError(
17
13
  'Invalid <invoke> tag. Missing function attribute. Expected: <invoke console.log("Hello World")'
@@ -31,14 +27,14 @@ module.exports = function migrator(elNode, context) {
31
27
  let replacement = renderCallToDynamicTag(functionAst, context);
32
28
 
33
29
  if (replacement) {
34
- elNode.forEachAttribute(attr => {
30
+ elNode.forEachAttribute((attr) => {
35
31
  if (attr !== functionAttr) {
36
32
  replacement.addAttribute(attr);
37
33
  }
38
34
  });
39
35
  } else {
40
36
  replacement = builder.scriptlet({
41
- value: functionCallExpression
37
+ value: functionCallExpression,
42
38
  });
43
39
  }
44
40
 
@@ -5,9 +5,6 @@ const commonTagMigrator = require("./all-tags");
5
5
  module.exports = function render(elNode, context) {
6
6
  commonTagMigrator(elNode, context);
7
7
  elNode.setTransformerApplied(commonTagMigrator);
8
- context.deprecate(
9
- "The <layout-placeholder> tag is deprecated. Please use the <${dynamic}> tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-layout-tag"
10
- );
11
8
 
12
9
  const builder = context.builder;
13
10
  const name = elNode.getAttributeValue("name");
@@ -3,9 +3,6 @@ const commonTagMigrator = require("./all-tags");
3
3
  module.exports = function migrator(oldNode, context) {
4
4
  commonTagMigrator(oldNode, context);
5
5
  oldNode.setTransformerApplied(commonTagMigrator);
6
- context.deprecate(
7
- 'The "<layout-put>" tag is deprecated and replaced with first class language support. See: https://github.com/marko-js/marko/wiki/Deprecation:-layout-tag'
8
- );
9
6
 
10
7
  const attributes = oldNode.attributes;
11
8
  if (!attributes) {
@@ -5,9 +5,6 @@ const commonTagMigrator = require("./all-tags");
5
5
  module.exports = function render(elNode, context) {
6
6
  commonTagMigrator(elNode, context);
7
7
  elNode.setTransformerApplied(commonTagMigrator);
8
- context.deprecate(
9
- "The <layout-use> tag is deprecated. Please use a combination of the <${dynamic}> tag and imports instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-layout-tag"
10
- );
11
8
 
12
9
  const rawArg = elNode.argument;
13
10
  const attributes = elNode.attributes;
@@ -1,9 +1,4 @@
1
1
  module.exports = function codeGenerator(elNode, context) {
2
- context.deprecate(
3
- 'The "<macro-body>" tag has been deprecated. Please use the <${dynamic}/> tag instead, eg: "<macro|input| ...><${input.renderBody}/></macro>". See: https://github.com/marko-js/marko/wiki/Deprecation:-legacy-macro',
4
- elNode
5
- );
6
-
7
2
  const builder = context.builder;
8
3
  const dynamicTag = builder.htmlElement(undefined, elNode.attributes);
9
4
  dynamicTag.rawTagNameExpression = "macroInput";
@@ -8,7 +8,7 @@ module.exports = function migrator(elNode, context) {
8
8
  if (
9
9
  !attributes.length ||
10
10
  attributes.some(
11
- attr => attr.name === "name" && attr.value.type === "Literal"
11
+ (attr) => attr.name === "name" && attr.value.type === "Literal"
12
12
  )
13
13
  ) {
14
14
  return;
@@ -22,11 +22,6 @@ module.exports = function migrator(elNode, context) {
22
22
  return elNode;
23
23
  }
24
24
 
25
- context.deprecate(
26
- 'The "<macro my-macro(input)>" syntax has been deprecated. Please use the new tag param syntax, eg: "<macro|input| name="my-macro">. See: https://github.com/marko-js/marko/wiki/Deprecation:-legacy-macro',
27
- elNode
28
- );
29
-
30
25
  const name = defAttr.name;
31
26
  const params = defAttr.argument
32
27
  ? builder.parseJavaScriptParams(defAttr.argument)
@@ -48,7 +43,7 @@ module.exports = function migrator(elNode, context) {
48
43
  params.push(builder.identifier("renderBody"));
49
44
  macroWalker.stop();
50
45
  }
51
- }
46
+ },
52
47
  });
53
48
 
54
49
  macroWalker.walk(elNode);
@@ -56,7 +51,7 @@ module.exports = function migrator(elNode, context) {
56
51
  params
57
52
  .slice()
58
53
  .reverse()
59
- .forEach(param => {
54
+ .forEach((param) => {
60
55
  const name = builder.identifier(param.name);
61
56
  const value = builder.memberExpression(
62
57
  builder.identifier("macroInput"),
@@ -67,7 +62,7 @@ module.exports = function migrator(elNode, context) {
67
62
  value: printJS(
68
63
  builder.vars([builder.variableDeclarator(name, value)]),
69
64
  context
70
- )
65
+ ),
71
66
  })
72
67
  );
73
68
  });
@@ -90,7 +85,7 @@ module.exports = function migrator(elNode, context) {
90
85
  child.addAttribute({ name: name, value: value });
91
86
  }
92
87
  }
93
- }
88
+ },
94
89
  });
95
90
 
96
91
  templateWalker.walk(context.root);
@@ -4,9 +4,6 @@ module.exports = function migrator(oldNode, context) {
4
4
  const attributes = oldNode.attributes;
5
5
  const argument = oldNode.argument;
6
6
 
7
- context.deprecate(
8
- 'The "<unless(x)>" tag is deprecated. Please use "<if(!x)>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-unless-tag'
9
- );
10
7
  if (!argument) {
11
8
  context.addError(
12
9
  "Invalid <unless> tag. Argument is missing. Example; <unless(foo === true)>"
@@ -15,7 +15,7 @@ module.exports = function addIdScopedAttr(context, el, attrValue) {
15
15
  );
16
16
  }
17
17
  }
18
- }
18
+ },
19
19
  });
20
20
  walker.walk(templateRoot);
21
21
  };