@marko/translator-default 5.26.4 → 5.27.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.
package/dist/index.js CHANGED
@@ -193,7 +193,13 @@ const translate = {
193
193
 
194
194
  if (file.metadata.marko.moduleCode) {
195
195
  path.
196
- replaceWith((0, _babelUtils.parseScript)(file, file.metadata.marko.moduleCode))[0].
196
+ replaceWith(
197
+ _compiler.types.program(
198
+ (0, _babelUtils.parseStatements)(file, file.metadata.marko.moduleCode),
199
+ undefined,
200
+ file.markoOpts.modules === "cjs" ? "script" : "module"))[
201
+
202
+ 0].
197
203
  skip();
198
204
  return;
199
205
  }
@@ -427,7 +433,7 @@ const translate = {
427
433
  metaObject.properties.push(
428
434
  _compiler.types.objectProperty(
429
435
  _compiler.types.identifier("deps"),
430
- (0, _babelUtils.parseExpression)(file, JSON.stringify(meta.deps), file.code.length)));
436
+ (0, _babelUtils.parseExpression)(file, JSON.stringify(meta.deps))));
431
437
 
432
438
 
433
439
  }
@@ -9,7 +9,7 @@ function _default(path) {
9
9
  } = path;
10
10
  const {
11
11
  rawValue: code,
12
- name: { start }
12
+ name: { start, end }
13
13
  } = node;
14
14
  const meta = file.metadata.marko;
15
15
 
@@ -29,7 +29,7 @@ function _default(path) {
29
29
 
30
30
  }
31
31
 
32
- const parsed = (0, _babelUtils.parseExpression)(file, code.replace(/;\s*$/, ""), start);
32
+ const parsed = (0, _babelUtils.parseExpression)(file, code.replace(/;\s*$/, ""), start, end);
33
33
 
34
34
  if (parsed.id) {
35
35
  throw file.buildCodeFrameError(
@@ -7,8 +7,8 @@ function _default(path) {
7
7
  } = path;
8
8
  const {
9
9
  rawValue,
10
- name: { start }
10
+ name: { start, end }
11
11
  } = node;
12
- const [exportNode] = (0, _babelUtils.parseScript)(file, rawValue, start).body;
12
+ const [exportNode] = (0, _babelUtils.parseStatements)(file, rawValue, start, end);
13
13
  path.replaceWith(exportNode);
14
14
  }
@@ -7,8 +7,8 @@ function _default(path) {
7
7
  } = path;
8
8
  const {
9
9
  rawValue,
10
- name: { start }
10
+ name: { start, end }
11
11
  } = node;
12
- const [importNode] = (0, _babelUtils.parseScript)(file, rawValue, start).body;
12
+ const [importNode] = (0, _babelUtils.parseStatements)(file, rawValue, start, end);
13
13
  path.replaceWith(importNode);
14
14
  }
@@ -6,10 +6,10 @@ function _default(path) {
6
6
  node,
7
7
  hub: { file }
8
8
  } = path;
9
- const { rawValue } = node;
9
+ const { rawValue, end } = node;
10
10
  const code = rawValue.replace(/^static\s*/, "").trim();
11
11
  const start = node.name.start + (rawValue.length - code.length);
12
- let { body } = (0, _babelUtils.parseScript)(file, code, start);
12
+ let body = (0, _babelUtils.parseStatements)(file, code, start, end);
13
13
  if (body.length === 1 && _compiler.types.isBlockStatement(body[0])) {
14
14
  body = body[0].body;
15
15
  }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@marko/translator-default",
3
3
  "description": "Translates Marko templates to the default Marko runtime.",
4
- "version": "5.26.4",
4
+ "version": "5.27.0",
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": {
8
8
  "@babel/runtime": "^7.16.0",
9
- "@marko/babel-utils": "^5.22.1",
9
+ "@marko/babel-utils": "^6.0.0",
10
10
  "escape-string-regexp": "^4.0.0",
11
11
  "magic-string": "^0.27.0",
12
12
  "self-closing-tags": "^1.0.1"
13
13
  },
14
14
  "devDependencies": {
15
- "@marko/compiler": "^5.28.4",
16
- "marko": "^5.26.4"
15
+ "@marko/compiler": "^5.29.0",
16
+ "marko": "^5.27.0"
17
17
  },
18
18
  "files": [
19
19
  "dist",