marko 4.26.3 → 4.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. package/README.md +1 -1
  2. package/bin/markoc.js +15 -15
  3. package/dist/compiler/ast/CustomTag.js +2 -2
  4. package/dist/core-tags/components/TransformHelper/handleLegacyBind.js +0 -4
  5. package/dist/core-tags/core/await/renderer.js +0 -4
  6. package/dist/core-tags/migrate/all-tags/body-only-if.js +0 -1
  7. package/dist/core-tags/migrate/all-tags/control-flow-directives.js +0 -1
  8. package/dist/core-tags/migrate/all-tags/dynamic-attributes.js +1 -2
  9. package/dist/core-tags/migrate/all-tags/include-directive.js +0 -2
  10. package/dist/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -2
  11. package/dist/core-tags/migrate/all-tags/marko-init.js +0 -2
  12. package/dist/core-tags/migrate/all-tags/modifier-key.js +0 -2
  13. package/dist/core-tags/migrate/all-tags/ref.js +1 -3
  14. package/dist/core-tags/migrate/all-tags/w-bind.js +0 -2
  15. package/dist/core-tags/migrate/all-tags/w-body.js +0 -2
  16. package/dist/core-tags/migrate/all-tags/w-config.js +0 -2
  17. package/dist/core-tags/migrate/all-tags/w-for.js +0 -3
  18. package/dist/core-tags/migrate/all-tags/w-id.js +1 -4
  19. package/dist/core-tags/migrate/all-tags/w-on.js +1 -4
  20. package/dist/core-tags/migrate/all-tags/w-preserve-attrs.js +0 -2
  21. package/dist/core-tags/migrate/all-tags/w-preserve.js +1 -3
  22. package/dist/core-tags/migrate/all-tags/widget-in-attrs.js +2 -11
  23. package/dist/core-tags/migrate/all-templates/non-standard-template-literals.js +0 -4
  24. package/dist/core-tags/migrate/all-templates/render-calls.js +0 -2
  25. package/dist/core-tags/migrate/assign-tag.js +0 -2
  26. package/dist/core-tags/migrate/async-fragment-tag.js +0 -2
  27. package/dist/core-tags/migrate/async-fragments-tag.js +0 -2
  28. package/dist/core-tags/migrate/await-tag.js +0 -7
  29. package/dist/core-tags/migrate/class-tag.js +0 -2
  30. package/dist/core-tags/migrate/component-globals-tag.js +0 -2
  31. package/dist/core-tags/migrate/for-tag.js +0 -2
  32. package/dist/core-tags/migrate/include-tag.js +0 -1
  33. package/dist/core-tags/migrate/invoke-tag.js +0 -2
  34. package/dist/core-tags/migrate/layout-placeholder-tag.js +0 -1
  35. package/dist/core-tags/migrate/layout-put-tag.js +0 -1
  36. package/dist/core-tags/migrate/layout-use-tag.js +0 -1
  37. package/dist/core-tags/migrate/macro-body-tag.js +0 -2
  38. package/dist/core-tags/migrate/macro-tag.js +0 -2
  39. package/dist/core-tags/migrate/unless-tag.js +0 -1
  40. package/dist/core-tags/migrate/var-tag.js +0 -2
  41. package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -10
  42. package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -4
  43. package/dist/runtime/RenderResult.js +0 -3
  44. package/dist/runtime/components/Component.js +0 -6
  45. package/dist/runtime/components/ComponentDef.js +0 -3
  46. package/dist/runtime/components/ServerComponent.js +0 -4
  47. package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -3
  48. package/dist/runtime/components/legacy/defineRenderer-legacy.js +1 -6
  49. package/dist/runtime/components/legacy/index.js +3 -1
  50. package/dist/runtime/helpers/for-of.js +3 -1
  51. package/dist/runtime/html/helpers/attr.js +0 -4
  52. package/dist/runtime/html/helpers/attrs.js +0 -2
  53. package/dist/runtime/html/helpers/merge-attrs.js +0 -3
  54. package/dist/runtime/vdom/VElement.js +0 -3
  55. package/dist/runtime/vdom/helpers/attrs.js +0 -2
  56. package/dist/taglib/taglib-loader/loadTagFromProps.js +15 -0
  57. package/docs/10-awesome-marko-features.md +1 -1
  58. package/docs/body-content.md +3 -3
  59. package/docs/class-components.md +6 -6
  60. package/docs/express.md +1 -1
  61. package/docs/fastify.md +4 -4
  62. package/docs/hapi.md +3 -3
  63. package/docs/http.md +1 -1
  64. package/docs/huncwot.md +1 -1
  65. package/docs/installing.md +2 -2
  66. package/docs/koa.md +2 -2
  67. package/docs/lasso.md +1 -1
  68. package/docs/marko-4-upgrade.md +1 -1
  69. package/docs/marko-v4.md +4 -4
  70. package/docs/marko-vs-react.md +2 -2
  71. package/docs/rendering.md +6 -6
  72. package/docs/server-side-rendering.md +3 -3
  73. package/docs/webpack.md +16 -16
  74. package/docs/why-is-marko-fast.md +3 -3
  75. package/package.json +1 -1
  76. package/src/compiler/Builder.js +13 -13
  77. package/src/compiler/CodeGenerator.js +2 -2
  78. package/src/compiler/CodeWriter.js +1 -1
  79. package/src/compiler/CompileContext.js +30 -30
  80. package/src/compiler/Compiler.js +3 -3
  81. package/src/compiler/HtmlJsParser.js +4 -4
  82. package/src/compiler/Migrator.js +2 -2
  83. package/src/compiler/Normalizer.js +5 -5
  84. package/src/compiler/Parser.js +11 -11
  85. package/src/compiler/Walker.js +1 -1
  86. package/src/compiler/ast/ArrayExpression.js +1 -1
  87. package/src/compiler/ast/BinaryExpression.js +1 -1
  88. package/src/compiler/ast/ConditionalExpression.js +1 -1
  89. package/src/compiler/ast/CustomTag.js +14 -14
  90. package/src/compiler/ast/Declaration.js +2 -2
  91. package/src/compiler/ast/DocumentType.js +2 -2
  92. package/src/compiler/ast/ForEach.js +1 -1
  93. package/src/compiler/ast/ForEachProp.js +1 -1
  94. package/src/compiler/ast/ForRange.js +1 -1
  95. package/src/compiler/ast/HtmlAttribute/html/generateCode.js +4 -4
  96. package/src/compiler/ast/HtmlAttribute/vdom/generateCode.js +2 -2
  97. package/src/compiler/ast/HtmlAttributeCollection.js +3 -3
  98. package/src/compiler/ast/HtmlComment.js +1 -1
  99. package/src/compiler/ast/HtmlElement/html/EndTag.js +1 -1
  100. package/src/compiler/ast/HtmlElement/html/StartTag.js +3 -3
  101. package/src/compiler/ast/HtmlElement/html/generateCode.js +5 -5
  102. package/src/compiler/ast/HtmlElement/index.js +1 -1
  103. package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
  104. package/src/compiler/ast/HtmlElement/vdom/generateCode.js +3 -3
  105. package/src/compiler/ast/If.js +1 -1
  106. package/src/compiler/ast/LogicalExpression.js +1 -1
  107. package/src/compiler/ast/MemberExpression.js +1 -1
  108. package/src/compiler/ast/NewExpression.js +1 -1
  109. package/src/compiler/ast/Node.js +4 -4
  110. package/src/compiler/ast/ObjectExpression.js +2 -2
  111. package/src/compiler/ast/Property.js +1 -1
  112. package/src/compiler/ast/SequenceExpression.js +1 -1
  113. package/src/compiler/ast/TemplateLiteral.js +1 -1
  114. package/src/compiler/ast/TemplateRoot.js +3 -3
  115. package/src/compiler/ast/Text/index.js +1 -1
  116. package/src/compiler/ast/UnaryExpression.js +1 -1
  117. package/src/compiler/ast/UpdateExpression.js +1 -1
  118. package/src/compiler/config.js +1 -1
  119. package/src/compiler/index.js +5 -5
  120. package/src/compiler/modules.js +2 -2
  121. package/src/compiler/util/UniqueVars.js +4 -4
  122. package/src/compiler/util/convertRawJavaScriptAst.js +1 -1
  123. package/src/compiler/util/javaScriptReservedWords.js +1 -1
  124. package/src/compiler/util/macros.js +1 -1
  125. package/src/compiler/util/mergeProps.js +3 -3
  126. package/src/compiler/util/parseJavaScriptArgs.js +1 -1
  127. package/src/compiler/util/parseJavaScriptParams.js +1 -1
  128. package/src/compiler/util/parseRawJavaScriptAst.js +1 -1
  129. package/src/compiler/util/removeComments.js +6 -6
  130. package/src/compiler/util/tokenizer.js +3 -3
  131. package/src/compiler/util/vdom/VDOMOptimizer.js +2 -2
  132. package/src/core-tags/cache/cached-fragment-tag.js +2 -2
  133. package/src/core-tags/cache/default-cache-manager.js +2 -2
  134. package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +3 -3
  135. package/src/core-tags/components/TransformHelper/assignComponentId.js +3 -3
  136. package/src/core-tags/components/TransformHelper/convertToComponent.js +4 -4
  137. package/src/core-tags/components/TransformHelper/getComponentFiles.js +1 -1
  138. package/src/core-tags/components/TransformHelper/handleComponentEvents.js +3 -3
  139. package/src/core-tags/components/TransformHelper/handleComponentPreserve.js +7 -7
  140. package/src/core-tags/components/TransformHelper/handleLegacyBind.js +2 -8
  141. package/src/core-tags/components/TransformHelper/handleRootNodes.js +14 -14
  142. package/src/core-tags/components/TransformHelper/handleScopedAttrs.js +1 -1
  143. package/src/core-tags/components/TransformHelper/index.js +1 -1
  144. package/src/core-tags/components/component-tag.js +1 -1
  145. package/src/core-tags/components/components-transformer.js +2 -2
  146. package/src/core-tags/components/util/generateRegisterComponentCode.js +2 -2
  147. package/src/core-tags/components/widget-types-tag.js +2 -2
  148. package/src/core-tags/core/await/AsyncValue.js +1 -1
  149. package/src/core-tags/core/await/renderer.js +3 -12
  150. package/src/core-tags/core/await/reorderer-renderer.js +1 -1
  151. package/src/core-tags/core/core-transformer.js +5 -5
  152. package/src/core-tags/core/html-comment-tag.js +1 -1
  153. package/src/core-tags/core/import-tag.js +1 -1
  154. package/src/core-tags/core/util/parseImport.js +8 -8
  155. package/src/core-tags/html/normalize-script-text.js +1 -1
  156. package/src/core-tags/migrate/all-tags/body-only-if.js +4 -5
  157. package/src/core-tags/migrate/all-tags/control-flow-directives.js +2 -5
  158. package/src/core-tags/migrate/all-tags/dynamic-attributes.js +1 -4
  159. package/src/core-tags/migrate/all-tags/include-directive.js +0 -4
  160. package/src/core-tags/migrate/all-tags/index.js +2 -2
  161. package/src/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -5
  162. package/src/core-tags/migrate/all-tags/marko-init.js +2 -8
  163. package/src/core-tags/migrate/all-tags/modifier-key.js +1 -7
  164. package/src/core-tags/migrate/all-tags/params.js +1 -1
  165. package/src/core-tags/migrate/all-tags/ref.js +1 -5
  166. package/src/core-tags/migrate/all-tags/w-bind.js +8 -12
  167. package/src/core-tags/migrate/all-tags/w-body.js +3 -7
  168. package/src/core-tags/migrate/all-tags/w-config.js +1 -5
  169. package/src/core-tags/migrate/all-tags/w-for.js +1 -8
  170. package/src/core-tags/migrate/all-tags/w-id.js +1 -8
  171. package/src/core-tags/migrate/all-tags/w-on.js +2 -9
  172. package/src/core-tags/migrate/all-tags/w-preserve-attrs.js +1 -5
  173. package/src/core-tags/migrate/all-tags/w-preserve.js +3 -7
  174. package/src/core-tags/migrate/all-tags/widget-in-attrs.js +4 -17
  175. package/src/core-tags/migrate/all-templates/index.js +2 -2
  176. package/src/core-tags/migrate/all-templates/non-standard-template-literals.js +6 -12
  177. package/src/core-tags/migrate/all-templates/render-calls.js +4 -8
  178. package/src/core-tags/migrate/all-templates/widget-data-is-state.js +2 -2
  179. package/src/core-tags/migrate/all-templates/widget-get-template-data.js +2 -2
  180. package/src/core-tags/migrate/assign-tag.js +2 -6
  181. package/src/core-tags/migrate/async-fragment-tag.js +2 -6
  182. package/src/core-tags/migrate/async-fragments-tag.js +0 -4
  183. package/src/core-tags/migrate/await-tag.js +8 -23
  184. package/src/core-tags/migrate/class-tag.js +0 -4
  185. package/src/core-tags/migrate/component-globals-tag.js +0 -4
  186. package/src/core-tags/migrate/for-tag.js +12 -16
  187. package/src/core-tags/migrate/include-tag.js +2 -5
  188. package/src/core-tags/migrate/invoke-tag.js +2 -6
  189. package/src/core-tags/migrate/layout-placeholder-tag.js +0 -3
  190. package/src/core-tags/migrate/layout-put-tag.js +0 -3
  191. package/src/core-tags/migrate/layout-use-tag.js +0 -3
  192. package/src/core-tags/migrate/macro-body-tag.js +0 -5
  193. package/src/core-tags/migrate/macro-tag.js +5 -10
  194. package/src/core-tags/migrate/unless-tag.js +0 -3
  195. package/src/core-tags/migrate/util/addIdScopedAttr.js +1 -1
  196. package/src/core-tags/migrate/util/import-tag.js +6 -6
  197. package/src/core-tags/migrate/util/parseFor.js +20 -20
  198. package/src/core-tags/migrate/util/renderCallToDynamicTag.js +7 -7
  199. package/src/core-tags/migrate/var-tag.js +4 -8
  200. package/src/express.js +1 -1
  201. package/src/hot-reload.js +3 -3
  202. package/src/node-require/index.js +1 -1
  203. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +4 -55
  204. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -10
  205. package/src/runtime/RenderResult.js +3 -16
  206. package/src/runtime/components/Component.js +2 -23
  207. package/src/runtime/components/ComponentDef.js +2 -8
  208. package/src/runtime/components/ComponentsContext.js +1 -1
  209. package/src/runtime/components/ServerComponent.js +0 -6
  210. package/src/runtime/components/State.js +2 -2
  211. package/src/runtime/components/attach-detach.js +1 -1
  212. package/src/runtime/components/dom-data.js +1 -1
  213. package/src/runtime/components/legacy/defineComponent-legacy.js +0 -5
  214. package/src/runtime/components/legacy/defineRenderer-legacy.js +1 -16
  215. package/src/runtime/components/legacy/dependencies/index.js +10 -10
  216. package/src/runtime/components/legacy/index.js +5 -0
  217. package/src/runtime/components/legacy/renderer-legacy.js +1 -1
  218. package/src/runtime/components/update-manager.js +1 -1
  219. package/src/runtime/dom-insert.js +1 -1
  220. package/src/runtime/helpers/_weak-map.js +1 -1
  221. package/src/runtime/helpers/bind-component.js +1 -1
  222. package/src/runtime/helpers/for-of.js +1 -6
  223. package/src/runtime/html/AsyncStream.js +5 -5
  224. package/src/runtime/html/BufferedWriter.js +1 -1
  225. package/src/runtime/html/StringWriter.js +1 -1
  226. package/src/runtime/html/helpers/attr.js +0 -9
  227. package/src/runtime/html/helpers/attrs.js +0 -6
  228. package/src/runtime/html/helpers/merge-attrs.js +0 -8
  229. package/src/runtime/html/index.js +1 -1
  230. package/src/runtime/renderable.js +1 -1
  231. package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
  232. package/src/runtime/vdom/VComment.js +1 -1
  233. package/src/runtime/vdom/VComponent.js +1 -1
  234. package/src/runtime/vdom/VDocumentFragment.js +1 -1
  235. package/src/runtime/vdom/VElement.js +4 -11
  236. package/src/runtime/vdom/VFragment.js +1 -1
  237. package/src/runtime/vdom/VNode.js +1 -1
  238. package/src/runtime/vdom/VText.js +1 -1
  239. package/src/runtime/vdom/helpers/attrs.js +0 -7
  240. package/src/runtime/vdom/index.js +1 -1
  241. package/src/runtime/vdom/morphdom/fragment.js +1 -1
  242. package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
  243. package/src/taglib/taglib-finder/index.js +5 -5
  244. package/src/taglib/taglib-loader/Tag.js +8 -8
  245. package/src/taglib/taglib-loader/Taglib.js +1 -1
  246. package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
  247. package/src/taglib/taglib-loader/loadTagFromProps.js +29 -14
  248. package/src/taglib/taglib-loader/loadTaglibFromProps.js +9 -9
  249. package/src/taglib/taglib-loader/scanTagsDir.js +6 -6
  250. package/src/taglib/taglib-lookup/TaglibLookup.js +8 -8
package/README.md CHANGED
@@ -89,7 +89,7 @@ module.exports = {
89
89
  },
90
90
  increment() {
91
91
  this.state.count++;
92
- }
92
+ },
93
93
  };
94
94
  ```
95
95
 
package/bin/markoc.js CHANGED
@@ -42,7 +42,7 @@ markoCompiler.defaultOptions.checkUpToDate = false;
42
42
  var mmOptions = {
43
43
  matchBase: true,
44
44
  dot: true,
45
- flipNegate: true
45
+ flipNegate: true,
46
46
  };
47
47
 
48
48
  function relPath(path) {
@@ -55,41 +55,41 @@ var args = require("argly")
55
55
  .createParser({
56
56
  "--help": {
57
57
  type: "boolean",
58
- description: "Show this help message"
58
+ description: "Show this help message",
59
59
  },
60
60
  "--files --file -f *": {
61
61
  type: "string[]",
62
- description: "A set of directories or files to compile"
62
+ description: "A set of directories or files to compile",
63
63
  },
64
64
  "--ignore -i": {
65
65
  type: "string[]",
66
- description: 'An ignore rule (default: --ignore "/node_modules" ".*")'
66
+ description: 'An ignore rule (default: --ignore "/node_modules" ".*")',
67
67
  },
68
68
  "--clean -c": {
69
69
  type: "boolean",
70
- description: "Clean all of the *.marko.js files"
70
+ description: "Clean all of the *.marko.js files",
71
71
  },
72
72
  "--force": {
73
73
  type: "boolean",
74
- description: "Force template recompilation even if unchanged"
74
+ description: "Force template recompilation even if unchanged",
75
75
  },
76
76
  "--paths -p": {
77
77
  type: "string[]",
78
78
  description:
79
- "Additional directories to add to the Node.js module search path"
79
+ "Additional directories to add to the Node.js module search path",
80
80
  },
81
81
  "--quiet -q": {
82
82
  type: "boolean",
83
- description: "Only print warnings and errors"
83
+ description: "Only print warnings and errors",
84
84
  },
85
85
  "--vdom -V": {
86
86
  type: "boolean",
87
- description: "VDOM output"
87
+ description: "VDOM output",
88
88
  },
89
89
  "--version -v": {
90
90
  type: "boolean",
91
- description: "Print markoc and marko compiler versions to the console"
92
- }
91
+ description: "Print markoc and marko compiler versions to the console",
92
+ },
93
93
  })
94
94
  .usage("Usage: $0 <pattern> [options]")
95
95
  .example("Compile a single template", "$0 template.marko")
@@ -141,7 +141,7 @@ var compileOptions = {
141
141
  output: output,
142
142
  browser: isForBrowser,
143
143
  compilerType: "markoc",
144
- compilerVersion: markoPkgVersion || markocPkgVersion
144
+ compilerVersion: markoPkgVersion || markocPkgVersion,
145
145
  };
146
146
 
147
147
  var force = args.force;
@@ -240,7 +240,7 @@ function walk(files, options, done) {
240
240
  done(null);
241
241
  }
242
242
  }
243
- }
243
+ },
244
244
  };
245
245
 
246
246
  function doWalk(dir) {
@@ -314,7 +314,7 @@ if (args.clean) {
314
314
  context.endAsync();
315
315
  });
316
316
  }
317
- }
317
+ },
318
318
  },
319
319
  function () {
320
320
  if (deleteCount === 0) {
@@ -392,7 +392,7 @@ if (args.clean) {
392
392
  ) {
393
393
  compile(file, context);
394
394
  }
395
- }
395
+ },
396
396
  },
397
397
  function (err) {
398
398
  if (err) {
@@ -506,8 +506,8 @@ class CustomTag extends HtmlElement {
506
506
  return builder.property(builder.literal(propName), properties[propName]);
507
507
  })) : builder.literalNull()];
508
508
  } else {
509
- loadTag = builder.functionCall(context.helper("loadTag"), [requireRendererFunctionCall // The first param is the renderer
510
- ]);
509
+ loadTag = builder.functionCall(context.helper("loadTag"), [requireRendererFunctionCall] // The first param is the renderer
510
+ );
511
511
 
512
512
  tagArgs = [inputProps, builder.identifierOut()];
513
513
  }
@@ -35,10 +35,6 @@ module.exports = function handleLegacyBind() {
35
35
 
36
36
  const hasWidgetTypes = context.isFlagSet("hasWidgetTypes");
37
37
 
38
- if (hasWidgetTypes) {
39
- context.deprecate("The <widget-types> tag is deprecated. Please remove it. See: https://github.com/marko-js/marko/issues/514");
40
- }
41
-
42
38
  if (bindAttrValue != null && !bindAttr.isLiteralValue()) {
43
39
  // This is a dynamic expression. The <widget-types> should have been found.
44
40
  if (!hasWidgetTypes) {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var complain;
4
3
  var AsyncValue = require("./AsyncValue");
5
4
 
6
5
  function safeRenderBody(renderBody, targetOut, data) {
@@ -15,7 +14,6 @@ function requestData(provider, timeout) {
15
14
  var asyncValue = new AsyncValue();
16
15
 
17
16
  if (typeof provider === "function") {
18
-
19
17
  var callback = function (err, data) {
20
18
  if (err) {
21
19
  asyncValue.l_(err);
@@ -23,8 +21,6 @@ function requestData(provider, timeout) {
23
21
  asyncValue.m_(data);
24
22
  }
25
23
  };
26
- // eslint-disable-next-line no-constant-condition
27
-
28
24
 
29
25
  var value = provider.length === 1 ? // one argument so only provide callback to function call
30
26
  provider(callback) : // two arguments so provide args and callback to function call
@@ -4,7 +4,6 @@ module.exports = function migrator(node, context) {
4
4
  const arg = node.getAttribute("body-only-if");
5
5
 
6
6
  if (arg) {
7
- context.deprecate('The "body-only-if(x)" tag is deprecated. Please use "<${test ? null : tag>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-body‐only‐if');
8
7
  // Check if body-only-if(true) is set and automatically unwrap element
9
8
  if (arg.argument === "true") {
10
9
  // w-body will take care of the unwrapping
@@ -7,7 +7,6 @@ module.exports = function migrate(el, context) {
7
7
  const name = attr.name;
8
8
  if (CONTROL_FLOW_ATTRIBUTES.includes(name) && (name === "else" || attr.argument) && !(el.tagName === "else" && name === "if") // <else if(x)> gets passed through
9
9
  ) {
10
- context.deprecate(`The "${name}" attribute is deprecated. Please use the <${name}> tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-control-flow-attributes`);
11
10
  el.removeAttribute(name);
12
11
  el.wrapWith(builder.htmlElement(name, undefined, undefined, attr.argument));
13
12
  }
@@ -1,7 +1,6 @@
1
- module.exports = function migrate(el, context) {
1
+ module.exports = function migrate(el) {
2
2
  el.forEachAttribute((attr, index) => {
3
3
  if (!attr.name && !attr.spread) {
4
- context.deprecate('The "${attributes}" is deprecated. Please use "...attributes" modifier instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes');
5
4
  const attribute = el.attributes.splice(index, 1)[0];
6
5
  attribute.spread = true;
7
6
  el.attributes.unshift(attribute);
@@ -6,8 +6,6 @@ module.exports = function migrate(el, context) {
6
6
  return;
7
7
  }
8
8
 
9
- context.deprecate('The "include" attribute is deprecated. Please use the <${dynamic}> tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-include-tag');
10
-
11
9
  el.removeAttribute("include");
12
10
  el.appendChild(builder.htmlElement("include", undefined, undefined, attr.argument));
13
11
  };
@@ -12,6 +12,4 @@ module.exports = function migrate(el, context) {
12
12
 
13
13
  const nestedTagName = match[1];
14
14
  el.tagName = `@${nestedTagName}`;
15
-
16
- context.deprecate('The "<my-tag:nested>" tagName syntax is deprecated. Please use the "<@nested>" tagName syntax instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-legacy-nested-tags', el);
17
15
  };
@@ -8,7 +8,6 @@ module.exports = function migrate(el, context) {
8
8
  return;
9
9
  }
10
10
 
11
- context.deprecate('The "marko-init" attribute is deprecated. Use the static tag instead. See https://github.com/marko-js/marko/wiki/Deprecation:-script-template-helpers');
12
11
  el.removeAttribute("marko-init");
13
12
  } else if (el.hasAttribute("template-helpers")) {
14
13
  if (el.tagName !== "script") {
@@ -16,7 +15,6 @@ module.exports = function migrate(el, context) {
16
15
  return;
17
16
  }
18
17
 
19
- context.deprecate('The "template-helpers" attribute is deprecated and will be removed in the next release candidate. Use the static tag instead. See https://github.com/marko-js/marko/wiki/Deprecation:-script-template-helpers');
20
18
  el.removeAttribute("template-helpers");
21
19
  } else {
22
20
  return;
@@ -7,10 +7,8 @@ module.exports = function migrate(el, context) {
7
7
  let value = attr.value;
8
8
 
9
9
  if (name && name.endsWith(":key")) {
10
- context.deprecate(`The ":key" modifier is deprecated. Please use ":scoped" modifier instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
11
10
  name = name.slice(0, 0 - ":key".length) + ":scoped";
12
11
  } else if (value && value.type === "FunctionCall" && componentElId.test(attr.rawValue)) {
13
- context.deprecate(`Using component.${value.callee.property.name} as an attribute is deprecated. Please use ":scoped" modifier instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
14
12
  name += ":scoped";
15
13
  value = value.args[0];
16
14
  } else {
@@ -1,11 +1,9 @@
1
- module.exports = function migrate(el, context) {
1
+ module.exports = function migrate(el) {
2
2
  const attr = el.getAttribute("ref");
3
3
  if (!attr) {
4
4
  return;
5
5
  }
6
6
 
7
- context.deprecate(`The "ref" attribute is deprecated. Please use "key" attribute instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-ref-attribute`);
8
-
9
7
  el.setAttributeValue("key", attr.value);
10
8
  el.removeAttribute(attr.name);
11
9
  };
@@ -14,8 +14,6 @@ module.exports = function migrate(el, context) {
14
14
 
15
15
  context.setMeta("legacy", true);
16
16
 
17
- context.deprecate("Legacy components using w-bind and defineRenderer/defineComponent or defineComponent are deprecated. See: https://github.com/marko-js/marko/issues/421");
18
-
19
17
  if (value == null) {
20
18
  componentModule = getDefaultWidgetFile(context.dirname);
21
19
 
@@ -5,8 +5,6 @@ module.exports = function migrate(el, context) {
5
5
  return;
6
6
  }
7
7
 
8
- context.deprecate('The "w-body" attribute is deprecated. Please use the "<${dynamicTag}/>" tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-Widget-body-(w‐body)');
9
-
10
8
  const builder = context.builder;
11
9
  const defaultValue = builder.identifier("input");
12
10
  const bodyValue = el.getAttributeValue("w-body") || defaultValue;
@@ -7,8 +7,6 @@ module.exports = function migrate(el, context) {
7
7
  return;
8
8
  }
9
9
 
10
- context.deprecate('The "w-config" attribute is deprecated. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐config');
11
-
12
10
  if (attr.value) {
13
11
  el.insertSiblingBefore(builder.scriptlet({
14
12
  value: printJS(builder.assignment(builder.memberExpression(builder.identifier("component"), builder.identifier("widgetConfig")), attr.value, "="), context)
@@ -10,10 +10,7 @@ module.exports = function migrate(el, context) {
10
10
  }
11
11
 
12
12
  if (name === "w-for" && !findBoundParent(el)) {
13
- context.deprecate(`Using "w-for" in a template without a "w-bind" is deprecated. The "${name}" attribute is also deprecated. Please use "for:scoped" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
14
13
  context.setMigrationFlag("legacyWidgetAttrsWithoutBind");
15
- } else {
16
- context.deprecate(`The "${name}" attribute is deprecated. Please use "for:scoped" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
17
14
  }
18
15
 
19
16
  if (el.hasAttribute("for:scoped")) {
@@ -6,10 +6,7 @@ module.exports = function migrate(el, context) {
6
6
  return;
7
7
  }
8
8
 
9
- if (findBoundParent(el)) {
10
- context.deprecate(`The "w-id" attribute is deprecated. Please use "key" attribute instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
11
- } else {
12
- context.deprecate(`Using "w-id" in a template without a "w-bind" is deprecated. The "w-id" attribute is also deprecated. Please use "key" attribute instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
9
+ if (!findBoundParent(el)) {
13
10
  context.setMigrationFlag("legacyWidgetAttrsWithoutBind");
14
11
  }
15
12
 
@@ -8,10 +8,7 @@ module.exports = function migrate(el, context) {
8
8
  return;
9
9
  }
10
10
 
11
- if (findBoundParent(el)) {
12
- context.deprecate(`The "w-on*" attributes are deprecated. Please use "on*()" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
13
- } else {
14
- context.deprecate(`Using "w-on*" in a template without a "w-bind" is deprecated. The "w-on*" attributes are also deprecated. Please use "on*()" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
11
+ if (!findBoundParent(el)) {
15
12
  context.setMigrationFlag("legacyWidgetAttrsWithoutBind");
16
13
  }
17
14
 
@@ -5,8 +5,6 @@ module.exports = function migrate(el, context) {
5
5
  }
6
6
 
7
7
  const values = attr.value.value;
8
- context.deprecate(`The "w-preserve-attrs" attribute is deprecated. Please use ":no-update" modifier instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
9
-
10
8
  values.split(",").forEach(val => {
11
9
  const existingAttr = el.getAttribute(val);
12
10
 
@@ -4,7 +4,7 @@ const newTags = {
4
4
  "w-preserve-body": "no-update-body",
5
5
  "w-preserve-body-if": "no-update-body-if"
6
6
  };
7
- module.exports = function migrate(el, context) {
7
+ module.exports = function migrate(el) {
8
8
  el.forEachAttribute(attr => {
9
9
  const name = attr.name;
10
10
  if (!name || !Object.keys(newTags).includes(name)) {
@@ -12,8 +12,6 @@ module.exports = function migrate(el, context) {
12
12
  }
13
13
 
14
14
  const newAttrName = newTags[name];
15
- context.deprecate(`The "${name}" attribute is deprecated. Please use "${newAttrName}" attribute instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
16
-
17
15
  attr.name = newAttrName;
18
16
  });
19
17
  };
@@ -3,27 +3,18 @@ module.exports = function migrate(el, context) {
3
3
  const value = attr.value;
4
4
 
5
5
  if (isWidgetElIdFunctionCall(value) && el.tagName !== "var" && el.tagName !== "assign") {
6
- context.deprecate(`The "*=widget.elId("someId")" is deprecated. Please use "*:scoped="someId"" modifier instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-w‐*-Attributes`);
7
-
8
6
  attr.name += ":scoped";
9
7
  attr.value = value.args[0];
10
8
  return;
11
9
  }
12
10
 
13
- let found;
14
- const walker = context.createWalker({
11
+ context.createWalker({
15
12
  enter(node) {
16
13
  if (isWidgetMemberExpression(node)) {
17
14
  node.object.name = "component";
18
- found = true;
19
15
  }
20
16
  }
21
- });
22
- walker.walk(value);
23
-
24
- if (found) {
25
- context.deprecate(`The "widget" variable is deprecated. Please use "component" instead.`);
26
- }
17
+ }).walk(value);
27
18
  });
28
19
  };
29
20
 
@@ -25,10 +25,6 @@ module.exports = function migrator(el, context) {
25
25
 
26
26
  walker.walk(el);
27
27
 
28
- if (found) {
29
- context.deprecate("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");
30
- }
31
-
32
28
  if (literals.length) {
33
29
  context.addMigration({
34
30
  description: "Migrate template with non standard template literals",
@@ -19,8 +19,6 @@ module.exports = function migrator(el, context) {
19
19
  return;
20
20
  }
21
21
 
22
- context.deprecate("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");
23
-
24
22
  if (hasErrors) {
25
23
  return;
26
24
  }
@@ -7,8 +7,6 @@ module.exports = function migrator(elNode, context) {
7
7
  commonTagMigrator(elNode, context);
8
8
  elNode.setTransformerApplied(commonTagMigrator);
9
9
 
10
- context.deprecate('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');
11
-
12
10
  if (!attributes) {
13
11
  context.addError("Invalid <assign> tag. Argument is missing. Example; <assign x=123 />");
14
12
  return elNode;
@@ -8,8 +8,6 @@ module.exports = function migrator(elNode, context) {
8
8
  const builder = context.builder;
9
9
  const attributes = elNode.attributes;
10
10
 
11
- context.deprecate(`The "<async-fragment>" tag is deprecated. Please use "<await>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-async-fragment`);
12
-
13
11
  if (!attributes || !attributes.length) {
14
12
  context.addError('Invalid <async-fragment> tag. Argument is missing. Example; <async-fragment data-provider=data.userInfo var="userInfo" />');
15
13
  return elNode;
@@ -5,8 +5,6 @@ module.exports = function migrator(elNode, context) {
5
5
  commonTagMigrator(elNode, context);
6
6
  elNode.setTransformerApplied(commonTagMigrator);
7
7
 
8
- context.deprecate(`The "<async-fragments>" tag is deprecated. Please use "<await-reorderer>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-async-fragment`);
9
-
10
8
  // all this tag ever did was handling of client reordering
11
9
  // we'll remove the attribute as that's all this new tag does
12
10
  elNode.removeAttribute("client-reorder");
@@ -9,8 +9,6 @@ module.exports = function migrator(elNode, context) {
9
9
  return;
10
10
  }
11
11
 
12
- context.deprecate('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');
13
-
14
12
  elNode.argument = undefined;
15
13
  let provider = builder.expression(match[2]);
16
14
  const varName = match[1];
@@ -70,23 +68,18 @@ module.exports = function migrator(elNode, context) {
70
68
 
71
69
  let placeholderBody;
72
70
  if (elNode.hasAttribute("placeholder")) {
73
- context.deprecate('The "placeholder" attribute on the "<await>" tag is deprecated. Please use the "<@placeholder>" nested tag instead.');
74
-
75
71
  placeholderBody = [builder.text(elNode.getAttributeValue("placeholder"))];
76
72
  elNode.removeAttribute("placeholder");
77
73
  }
78
74
 
79
75
  let timeoutBody;
80
76
  if (elNode.hasAttribute("timeout-message")) {
81
- context.deprecate('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".');
82
-
83
77
  timeoutBody = [builder.text(elNode.getAttributeValue("timeout-message"))];
84
78
  elNode.removeAttribute("timeout-message");
85
79
  }
86
80
 
87
81
  let errorBody;
88
82
  if (elNode.hasAttribute("error-message")) {
89
- context.deprecate('The "error-message" attribute on the "<await>" tag is deprecated. Please use the "<@catch>" nested tag instead.');
90
83
  errorBody = [builder.text(elNode.getAttributeValue("error-message"))];
91
84
  elNode.removeAttribute("error-message");
92
85
  }
@@ -9,7 +9,5 @@ module.exports = function migrator(el, context) {
9
9
  context.addError("class is a static tag and can only be declared at the template root");
10
10
  }
11
11
 
12
- context.deprecate("Having a named class at the top level of a file is deprecated. Use `class {...}` without a name instead.");
13
-
14
12
  el.tagString = el.tagString.replace(classNamedRegexp, "$1$2");
15
13
  };
@@ -1,5 +1,3 @@
1
1
  module.exports = function render(elNode, context) {
2
- context.deprecate("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.");
3
-
4
2
  elNode.detach();
5
3
  };
@@ -19,8 +19,6 @@ function migrateForLoop(elNode, context) {
19
19
  return;
20
20
  }
21
21
 
22
- context.deprecate('The "<for(...)>" syntax has been deprecated, checkout the modern syntax here: https://github.com/marko-js/marko/wiki/Deprecation:-legacy-for');
23
-
24
22
  try {
25
23
  parsed = parseFor(elNode.argument);
26
24
  elNode.argument = undefined;
@@ -5,7 +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('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');
9
8
 
10
9
  const builder = context.builder;
11
10
  const rawArg = elNode.argument;
@@ -8,8 +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('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');
12
-
13
11
  if (!functionAttr) {
14
12
  context.addError('Invalid <invoke> tag. Missing function attribute. Expected: <invoke console.log("Hello World")');
15
13
  return;
@@ -5,7 +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("The <layout-placeholder> tag is deprecated. Please use the <${dynamic}> tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-layout-tag");
9
8
 
10
9
  const builder = context.builder;
11
10
  const name = elNode.getAttributeValue("name");
@@ -3,7 +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('The "<layout-put>" tag is deprecated and replaced with first class language support. See: https://github.com/marko-js/marko/wiki/Deprecation:-layout-tag');
7
6
 
8
7
  const attributes = oldNode.attributes;
9
8
  if (!attributes) {
@@ -5,7 +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("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");
9
8
 
10
9
  const rawArg = elNode.argument;
11
10
  const attributes = elNode.attributes;
@@ -1,6 +1,4 @@
1
1
  module.exports = function codeGenerator(elNode, context) {
2
- context.deprecate('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', elNode);
3
-
4
2
  const builder = context.builder;
5
3
  const dynamicTag = builder.htmlElement(undefined, elNode.attributes);
6
4
  dynamicTag.rawTagNameExpression = "macroInput";
@@ -14,8 +14,6 @@ module.exports = function migrator(elNode, context) {
14
14
  return elNode;
15
15
  }
16
16
 
17
- context.deprecate('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', elNode);
18
-
19
17
  const name = defAttr.name;
20
18
  const params = defAttr.argument ? builder.parseJavaScriptParams(defAttr.argument) : [];
21
19
  elNode.params = [builder.identifier("macroInput")];
@@ -4,7 +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('The "<unless(x)>" tag is deprecated. Please use "<if(!x)>" instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-unless-tag');
8
7
  if (!argument) {
9
8
  context.addError("Invalid <unless> tag. Argument is missing. Example; <unless(foo === true)>");
10
9
  return oldNode;
@@ -17,8 +17,6 @@ module.exports = function nodeFactory(elNode, context) {
17
17
  return elNode;
18
18
  }
19
19
 
20
- context.deprecate('The "<var>" 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');
21
-
22
20
  if (firstChild && firstChild.type === "Text" && /^\s+/.test(firstChild.argument.value)) {
23
21
  firstChild.argument.value = firstChild.argument.value.trimLeft();
24
22
  }
@@ -78,9 +78,6 @@ module.exports = function defineWidget(def, renderer) {
78
78
  },
79
79
  set: function (newState) {
80
80
  newState = newState || {};
81
- // eslint-disable-next-line no-constant-condition
82
-
83
-
84
81
  this.setState(newState);
85
82
  }
86
83
  });
@@ -88,15 +85,12 @@ module.exports = function defineWidget(def, renderer) {
88
85
  Object.defineProperty(proto, "__document", {
89
86
  get: function () {
90
87
  return this.E_;
91
- // eslint-disable-next-line no-constant-condition
92
88
  }
93
89
  });
94
90
 
95
91
  Object.defineProperty(proto, "el", {
96
92
  get: function () {
97
-
98
93
  return this.F_;
99
- // eslint-disable-next-line no-constant-condition
100
94
  }
101
95
  });
102
96
 
@@ -176,8 +170,6 @@ module.exports = function defineWidget(def, renderer) {
176
170
  this.J_ && this.J_(this.widgetConfig || {});
177
171
  this.G_ && this.G_({ firstRender: true });
178
172
  this.O_ = legacyRender;
179
-
180
- // eslint-disable-next-line no-constant-condition
181
173
  el.__widget = this;
182
174
  }
183
175
  } else if (el) {
@@ -256,10 +248,8 @@ module.exports = function defineWidget(def, renderer) {
256
248
  Component.renderSync = renderer.renderSync;
257
249
  }
258
250
 
259
- // eslint-disable-next-line no-constant-condition
260
251
  Component._isWidget = true;
261
252
 
262
-
263
253
  return Component;
264
254
  };
265
255
 
@@ -2,8 +2,6 @@ var Component = require("../../../runtime/components/Component");
2
2
  var loader = require("@internal/loader");
3
3
  var getComponentForEl = require("@internal/components-util").V_;
4
4
 
5
- var complain;
6
-
7
5
  // expose legacy
8
6
  require("@internal/components-registry")._j_ = exports;
9
7
  exports.load = function (typeName) {
@@ -54,11 +52,9 @@ var RenderResult = require("../../../runtime/RenderResult");
54
52
 
55
53
  RenderResult.prototype.getWidget = function () {
56
54
  return this.getWidgets()[0];
57
- // eslint-disable-next-line no-constant-condition
58
55
  };
59
56
  RenderResult.prototype.getWidgets = function () {
60
57
  return RenderResult.prototype.getComponents.apply(this, arguments).filter(function (component) {
61
58
  return component.B_;
62
59
  });
63
- // eslint-disable-next-line no-constant-condition
64
60
  };