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
@@ -78,7 +78,7 @@ function addTransformer(tagLoader, value) {
78
78
  properties[k] = value[k];
79
79
  }
80
80
  }
81
- }
81
+ },
82
82
  },
83
83
  tagLoader.dependencyChain.append("transformer")
84
84
  );
@@ -113,8 +113,8 @@ class TagLoader {
113
113
  "*": {
114
114
  type: "string",
115
115
  targetProperty: null,
116
- preserveName: false
117
- }
116
+ preserveName: false,
117
+ },
118
118
  };
119
119
  }
120
120
 
@@ -128,7 +128,7 @@ class TagLoader {
128
128
 
129
129
  if (typeof value === "string") {
130
130
  nestedVariable = {
131
- name: value
131
+ name: value,
132
132
  };
133
133
  } else {
134
134
  nestedVariable = {};
@@ -142,7 +142,7 @@ class TagLoader {
142
142
 
143
143
  nameFromAttribute: function (value) {
144
144
  nestedVariable.nameFromAttribute = value;
145
- }
145
+ },
146
146
  },
147
147
  dependencyChain.toString()
148
148
  );
@@ -255,15 +255,15 @@ class TagLoader {
255
255
  } else if (typeof value === "string") {
256
256
  if (hasNestedTag && hasAttr) {
257
257
  tagProps = attrProps = {
258
- type: value
258
+ type: value,
259
259
  };
260
260
  } else if (hasNestedTag) {
261
261
  tagProps = {
262
- type: value
262
+ type: value,
263
263
  };
264
264
  } else {
265
265
  attrProps = {
266
- type: value
266
+ type: value,
267
267
  };
268
268
  }
269
269
  }
@@ -444,14 +444,14 @@ class TagLoader {
444
444
  // so treat the value as the path to the JS
445
445
  // module for the transformer
446
446
  value = {
447
- path: value
447
+ path: value,
448
448
  };
449
449
 
450
450
  addTransformer(this, value);
451
451
  } else if (Array.isArray(value)) {
452
- value.forEach(transformerPath => {
452
+ value.forEach((transformerPath) => {
453
453
  value = {
454
- path: transformerPath
454
+ path: transformerPath,
455
455
  };
456
456
 
457
457
  addTransformer(this, value);
@@ -480,7 +480,7 @@ class TagLoader {
480
480
  */
481
481
  var(value) {
482
482
  complain("var is deprecated. Use tag parameters instead.", {
483
- location: this.filePath
483
+ location: this.filePath,
484
484
  });
485
485
  this._handleVar(value, this.dependencyChain.append("var"));
486
486
  }
@@ -491,7 +491,7 @@ class TagLoader {
491
491
  */
492
492
  vars(value) {
493
493
  complain("vars is deprecated. Use tag parameters instead.", {
494
- location: this.filePath
494
+ location: this.filePath,
495
495
  });
496
496
  if (value) {
497
497
  value.forEach((v, i) => {
@@ -510,6 +510,10 @@ class TagLoader {
510
510
  * - "body-function": "_handleBody(param1, param2, param3)"
511
511
  */
512
512
  bodyFunction(value) {
513
+ complain("body-function is deprecated.", {
514
+ location: this.filePath,
515
+ });
516
+
513
517
  var tag = this.tag;
514
518
  var parts = bodyFunctionRegExp.exec(value);
515
519
  if (!parts) {
@@ -557,10 +561,14 @@ class TagLoader {
557
561
  * }
558
562
  */
559
563
  importVar(value) {
564
+ complain("import-var is deprecated.", {
565
+ location: this.filePath,
566
+ });
567
+
560
568
  var tag = this.tag;
561
569
  forEachEntry(value, (varName, varValue) => {
562
570
  var importedVar = {
563
- targetProperty: varName
571
+ targetProperty: varName,
564
572
  };
565
573
 
566
574
  var expression = varValue;
@@ -644,6 +652,10 @@ class TagLoader {
644
652
  * DEPRECATED
645
653
  */
646
654
  escapeXmlBody(value) {
655
+ complain("escape-xml-body is deprecated.", {
656
+ location: this.filePath,
657
+ });
658
+
647
659
  if (value === false) {
648
660
  this.tag.escapeXmlBody = false;
649
661
  }
@@ -724,6 +736,9 @@ class TagLoader {
724
736
  }
725
737
 
726
738
  featureFlags(value) {
739
+ complain("feature-flags is deprecated.", {
740
+ location: this.filePath,
741
+ });
727
742
  this.tag.featureFlags = value;
728
743
  }
729
744
  }
@@ -5,7 +5,7 @@ var loaders = require("./loaders");
5
5
 
6
6
  var ok = require("assert").ok;
7
7
 
8
- function loadFromFile(filePath) {
8
+ function loadFromFile(filePath, isFromPackageJson) {
9
9
  ok(filePath, '"filePath" is required');
10
10
 
11
11
  var taglib = cache.get(filePath);
@@ -13,7 +13,7 @@ function loadFromFile(filePath) {
13
13
  // Only load a taglib once by caching the loaded taglibs using the file
14
14
  // system file path as the key
15
15
  if (!taglib) {
16
- taglib = new types.Taglib(filePath);
16
+ taglib = new types.Taglib(filePath, isFromPackageJson);
17
17
  cache.put(filePath, taglib);
18
18
 
19
19
  var taglibProps = jsonFileReader.readFileSync(filePath);
@@ -35,7 +35,7 @@ function addTransformer(taglibLoader, value) {
35
35
  path(value) {
36
36
  const path = markoModules.resolveFrom(dirname, value);
37
37
  transformer.path = path;
38
- }
38
+ },
39
39
  },
40
40
  taglibLoader.dependencyChain.append("transformer").toString()
41
41
  );
@@ -182,7 +182,7 @@ class TaglibLoader {
182
182
  // }
183
183
  var taglib = this.taglib;
184
184
 
185
- Object.keys(value).forEach(attrName => {
185
+ Object.keys(value).forEach((attrName) => {
186
186
  var attrDef = value[attrName];
187
187
 
188
188
  var attr = loaders.loadAttributeFromProps(
@@ -258,6 +258,24 @@ class TaglibLoader {
258
258
  }
259
259
  }
260
260
 
261
+ exports(dir) {
262
+ var taglib = this.taglib;
263
+ var path = this.filePath;
264
+ var dirname = this.dirname;
265
+
266
+ if (taglib.isFromPackageJson) {
267
+ taglib.tagsDir = false;
268
+
269
+ scanTagsDir(
270
+ path,
271
+ dirname,
272
+ dir,
273
+ taglib,
274
+ this.dependencyChain.append(`exports`)
275
+ );
276
+ }
277
+ }
278
+
261
279
  taglibImports(imports) {
262
280
  if (!resolveFrom) {
263
281
  return;
@@ -336,7 +354,7 @@ class TaglibLoader {
336
354
 
337
355
  if (typeof value === "string") {
338
356
  value = {
339
- path: value
357
+ path: value,
340
358
  };
341
359
  }
342
360
 
@@ -346,7 +364,7 @@ class TaglibLoader {
346
364
  path(value) {
347
365
  var path = markoModules.resolveFrom(dirname, value);
348
366
  transformer.path = path;
349
- }
367
+ },
350
368
  },
351
369
  this.dependencyChain.append("textTransformer").toString()
352
370
  );
@@ -381,14 +399,14 @@ class TaglibLoader {
381
399
  // so treat the value as the path to the JS
382
400
  // module for the transformer
383
401
  value = {
384
- path: value
402
+ path: value,
385
403
  };
386
404
 
387
405
  addTransformer(this, value);
388
406
  } else if (Array.isArray(value)) {
389
- value.forEach(transformerPath => {
407
+ value.forEach((transformerPath) => {
390
408
  value = {
391
- path: transformerPath
409
+ path: transformerPath,
392
410
  };
393
411
 
394
412
  addTransformer(this, value);
@@ -404,13 +422,13 @@ class TaglibLoader {
404
422
  taglib.attributeGroups || (taglib.attributeGroups = {});
405
423
  let dependencyChain = this.dependencyChain.append("attribute-groups");
406
424
 
407
- Object.keys(value).forEach(attrGroupName => {
425
+ Object.keys(value).forEach((attrGroupName) => {
408
426
  let attrGroup = (attributeGroups[attrGroupName] = {});
409
427
  let attrGroupDependencyChain = dependencyChain.append(attrGroupName);
410
428
 
411
429
  let rawAttrGroup = value[attrGroupName];
412
430
 
413
- Object.keys(rawAttrGroup).forEach(attrName => {
431
+ Object.keys(rawAttrGroup).forEach((attrName) => {
414
432
  var rawAttrDef = rawAttrGroup[attrName];
415
433
 
416
434
  let attr = loaders.loadAttributeFromProps(
@@ -14,7 +14,7 @@ const tagFileTypes = [
14
14
  "renderer",
15
15
  "transformer",
16
16
  "code-generator",
17
- "node-factory"
17
+ "node-factory",
18
18
  ];
19
19
 
20
20
  const searchFiles = [
@@ -25,7 +25,7 @@ const searchFiles = [
25
25
  { name: "template.html", type: "template" },
26
26
  { name: "code-generator", type: "code-generator" },
27
27
  { name: "node-factory", type: "node-factory" },
28
- { name: "transformer", type: "transformer" }
28
+ { name: "transformer", type: "transformer" },
29
29
  ];
30
30
 
31
31
  function createDefaultTagDef() {
@@ -34,9 +34,9 @@ function createDefaultTagDef() {
34
34
  "*": {
35
35
  type: "string",
36
36
  targetProperty: null,
37
- preserveName: false
38
- }
39
- }
37
+ preserveName: false,
38
+ },
39
+ },
40
40
  };
41
41
  }
42
42
 
@@ -44,7 +44,7 @@ function getFileMap(dirname) {
44
44
  let fileMap = {};
45
45
  let files = fs.readdirSync(dirname);
46
46
 
47
- files.forEach(file => {
47
+ files.forEach((file) => {
48
48
  let extName = nodePath.extname(file);
49
49
  let baseName = file.slice(0, -1 * extName.length);
50
50
  let fullPath = nodePath.join(dirname, file);
@@ -76,7 +76,7 @@ function merge(target, source) {
76
76
  class TaglibLookup {
77
77
  constructor() {
78
78
  this.merged = {
79
- attributeGroups: {}
79
+ attributeGroups: {},
80
80
  };
81
81
  this.taglibsById = {};
82
82
  this._inputFiles = null;
@@ -136,7 +136,7 @@ class TaglibLookup {
136
136
  textTransformers: taglib.textTransformers,
137
137
  attributes: taglib.attributes,
138
138
  patternAttributes: taglib.patternAttributes,
139
- attributeGroups: taglib.attributeGroups || {}
139
+ attributeGroups: taglib.attributeGroups || {},
140
140
  });
141
141
 
142
142
  this._mergeNestedTags(taglib);
@@ -147,7 +147,7 @@ class TaglibLookup {
147
147
 
148
148
  if (sortedTags === undefined) {
149
149
  sortedTags = this._sortedTags = [];
150
- this.forEachTag(tag => {
150
+ this.forEachTag((tag) => {
151
151
  sortedTags.push(tag);
152
152
  });
153
153
  sortedTags.sort(TAG_COMPARATOR);
@@ -228,7 +228,7 @@ class TaglibLookup {
228
228
  getTag(element) {
229
229
  if (typeof element === "string") {
230
230
  element = {
231
- tagName: element
231
+ tagName: element,
232
232
  };
233
233
  }
234
234
  var tags = this.merged.tags;
@@ -243,13 +243,13 @@ class TaglibLookup {
243
243
  getAttribute(element, attr) {
244
244
  if (typeof element === "string") {
245
245
  element = {
246
- tagName: element
246
+ tagName: element,
247
247
  };
248
248
  }
249
249
 
250
250
  if (typeof attr === "string") {
251
251
  attr = {
252
- name: attr
252
+ name: attr,
253
253
  };
254
254
  }
255
255
 
@@ -332,7 +332,7 @@ class TaglibLookup {
332
332
  forEachTagMigrator(element, callback, thisObj) {
333
333
  if (typeof element === "string") {
334
334
  element = {
335
- tagName: element
335
+ tagName: element,
336
336
  };
337
337
  }
338
338
 
@@ -394,7 +394,7 @@ class TaglibLookup {
394
394
  forEachTagTransformer(element, callback, thisObj) {
395
395
  if (typeof element === "string") {
396
396
  element = {
397
- tagName: element
397
+ tagName: element,
398
398
  };
399
399
  }
400
400