@marko/compiler 5.39.3 → 5.39.5

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.
@@ -204,7 +204,17 @@ Object.assign(_printer.default.prototype, {
204
204
  if (attributes.length) {
205
205
  if (tagName === "script") {
206
206
  for (let i = attributes.length; i--;) {
207
- if (attributes[i].value.fromBody) {
207
+ const attr = attributes[i];
208
+ if (
209
+ attr.name === "value" && (
210
+ attr.value.type === "ArrowFunctionExpression" ||
211
+ attr.value.type === "FunctionExpression") &&
212
+ !(
213
+ attr.value.generator ||
214
+ attr.value.returnType ||
215
+ attr.value.typeParameters))
216
+
217
+ {
208
218
  bodyOverride = attributes[i].value.body.body;
209
219
  attributes = toSpliced(attributes, i);
210
220
  break;
@@ -75,7 +75,7 @@ function parseTemplateLiteral(file, str, sourceStart, sourceEnd) {
75
75
  );
76
76
 
77
77
  if (parsed.type === "TemplateLiteral") {
78
- return parsed;
78
+ return _compiler.types.templateLiteral(parsed.quasis, parsed.expressions);
79
79
  }
80
80
 
81
81
  return ensureParseError(file, parsed, sourceStart, sourceEnd);
@@ -119,11 +119,19 @@ sourceOffset)
119
119
  const { parserOpts } = file.opts;
120
120
 
121
121
  if (typeof sourceStart === "number") {
122
- const startIndex = sourceStart - (sourceOffset || 0);
123
- const startLoc = (0, _loc.getLoc)(file, startIndex);
122
+ const startLoc = (0, _loc.getLoc)(file, sourceStart);
123
+ const startLine = startLoc.line;
124
+ let startIndex = sourceStart;
125
+ let startColumn = startLoc.column;
126
+
127
+ if (sourceOffset) {
128
+ startIndex -= sourceOffset;
129
+ startColumn -= sourceOffset;
130
+ }
131
+
132
+ parserOpts.startLine = startLine;
124
133
  parserOpts.startIndex = startIndex;
125
- parserOpts.startColumn = startLoc.column;
126
- parserOpts.startLine = startLoc.line;
134
+ parserOpts.startColumn = startColumn;
127
135
 
128
136
  try {
129
137
  return isExpression ?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
- "version": "5.39.3",
3
+ "version": "5.39.5",
4
4
  "description": "Marko template to JS compiler.",
5
5
  "keywords": [
6
6
  "babel",
@@ -10,7 +10,7 @@
10
10
  "parser",
11
11
  "plugin"
12
12
  ],
13
- "homepage": "https://github.com/marko-js/marko/blob/main/packages/marko/docs/compiler.md",
13
+ "homepage": "https://github.com/marko-js/marko/blob/main/packages/runtime-class/docs/compiler.md",
14
14
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
15
15
  "repository": {
16
16
  "type": "git",
@@ -86,7 +86,7 @@
86
86
  "source-map-support": "^0.5.21"
87
87
  },
88
88
  "devDependencies": {
89
- "marko": "^5.37.3"
89
+ "marko": "^5.37.5"
90
90
  },
91
91
  "publishConfig": {
92
92
  "access": "public"