@marko/compiler 5.21.3 → 5.21.6

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.
@@ -10,8 +10,9 @@ const noop = () => {};
10
10
  const emptyRange = (part) => part.start === part.end;
11
11
  const isAttrTag = (tag) => {var _tag$name$value;return ((_tag$name$value = tag.name.value) == null ? void 0 : _tag$name$value[0]) === "@";};
12
12
  const toBabelPosition = ({ line, character }) => ({
13
+ // Babel lines start at 1 and use "column" instead of "character".
13
14
  line: line + 1,
14
- column: character ? character - 1 : character });
15
+ column: character });
15
16
 
16
17
 
17
18
  function parseMarko(file) {
@@ -28,8 +29,6 @@ function parseMarko(file) {
28
29
  let onNext = noop;
29
30
  const positionAt = (index) => toBabelPosition(parser.positionAt(index));
30
31
  const locationAt = (range) => {
31
- // Babel columns start at 0, but that is silly.
32
- // Here we normalize the parsers 1 based columns.
33
32
  const { start, end } = parser.locationAt(range);
34
33
  return {
35
34
  start: toBabelPosition(start),
@@ -214,7 +213,7 @@ function parseMarko(file) {
214
213
 
215
214
 
216
215
  },
217
- onTagName(part) {
216
+ onOpenTagName(part) {
218
217
  const tagName = parseTemplateString(part);
219
218
  const node = t.markoTag(tagName, [], t.markoTagBody());
220
219
  let parseType = _htmljsParser.TagType.html;
@@ -326,12 +325,18 @@ function parseMarko(file) {
326
325
  },
327
326
 
328
327
  onAttrMethod(part) {
329
- const prefix = "function";
330
328
  currentAttr.end = part.end;
331
- currentAttr.value = (0, _babelUtils.parseExpression)(
329
+ currentAttr.value = withLoc(
330
+ t.functionExpression(
331
+ undefined,
332
+ (0, _babelUtils.parseExpression)(
332
333
  file,
333
- prefix + parser.read(part),
334
- part.start - prefix.length);
334
+ `${parser.read(part.params)}=>{}`,
335
+ part.params.start).
336
+ params,
337
+ (0, _babelUtils.parseScript)(file, parser.read(part.body), part.body.start).body[0]),
338
+
339
+ part);
335
340
 
336
341
  },
337
342
 
@@ -431,13 +436,13 @@ function parseMarko(file) {
431
436
  parseOptions.statement ||
432
437
  parseOptions.openTagOnly)
433
438
  {
434
- this.onCloseTag(part);
439
+ this.onCloseTagEnd(part);
435
440
  }
436
441
  } else if (part.selfClosed) {
437
- this.onCloseTag(part);
442
+ this.onCloseTagEnd(part);
438
443
  }
439
444
  },
440
- onCloseTag(part) {var _node$tagDef3;
445
+ onCloseTagEnd(part) {var _node$tagDef3;
441
446
  const { node } = currentTag;
442
447
  const parserPlugin = (_node$tagDef3 = node.tagDef) == null ? void 0 : _node$tagDef3.parser;
443
448
  if (preservingWhitespaceUntil === node) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
3
  "description": "Marko template to JS compiler.",
4
- "version": "5.21.3",
4
+ "version": "5.21.6",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
7
7
  "dependencies": {
@@ -16,7 +16,7 @@
16
16
  "@marko/babel-utils": "^5.21.1",
17
17
  "complain": "^1.6.0",
18
18
  "he": "^1.2.0",
19
- "htmljs-parser": "^3.3.4",
19
+ "htmljs-parser": "^5.0.0",
20
20
  "jsesc": "^3.0.2",
21
21
  "lasso-package-root": "^1.0.1",
22
22
  "property-handlers": "^1.1.1",