@marko/compiler 5.27.1 → 5.27.2

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.
@@ -46,6 +46,14 @@ const SOURCE_FILES = new WeakMap();var _default =
46
46
  return {
47
47
  name: "marko",
48
48
  manipulateOptions(opts) {
49
+ // We need to allow these for now since we are not parsing the entire file
50
+ // These types of syntax errors will be picked up by the bundler / runtime anyways.
51
+ opts.parserOpts.allowAwaitOutsideFunction =
52
+ opts.parserOpts.allowImportExportEverywhere =
53
+ opts.parserOpts.allowReturnOutsideFunction =
54
+ opts.parserOpts.allowSuperOutsideMethod =
55
+ opts.parserOpts.allowUndeclaredExports =
56
+ true;
49
57
  curOpts = opts;
50
58
  },
51
59
  parserOverride(code) {
@@ -65,7 +73,7 @@ const SOURCE_FILES = new WeakMap();var _default =
65
73
  _config.default.fs = markoOpts.fileSystem;
66
74
  curOpts = undefined;
67
75
  try {
68
- if (markoOpts.output === "source" || markoOpts.output === "migrate") {
76
+ if (isMarkoOutput(markoOpts.output)) {
69
77
  return file;
70
78
  }
71
79
 
@@ -106,7 +114,21 @@ const SOURCE_FILES = new WeakMap();var _default =
106
114
  } finally {
107
115
  _config.default.fs = prevFS;
108
116
  }
109
- }
117
+ },
118
+ visitor:
119
+ markoOpts.stripTypes && isMarkoOutput(markoOpts.output) ?
120
+ {
121
+ ExportNamedDeclaration: {
122
+ exit(path) {
123
+ // The babel typescript plugin will add an empty export declaration
124
+ // if there are no other imports/exports in the file.
125
+ // This is not needed for Marko file outputs since there is always
126
+ // a default export.
127
+ if (path.node.specifiers.length === 0) path.remove();
128
+ }
129
+ }
130
+ } :
131
+ undefined
110
132
  };
111
133
  };exports.default = _default;
112
134
 
@@ -324,4 +346,8 @@ function addPlugin(meta, arr, plugin) {
324
346
 
325
347
  function unique(item, i, list) {
326
348
  return list.indexOf(item) === i;
349
+ }
350
+
351
+ function isMarkoOutput(output) {
352
+ return output === "source" || output === "migrate";
327
353
  }
package/dist/index.js CHANGED
@@ -71,6 +71,7 @@ function loadBabelConfig(filename, config) {
71
71
  {
72
72
  isTSX: false,
73
73
  allowNamespaces: true,
74
+ allowDeclareFields: true,
74
75
  optimizeConstEnums: true,
75
76
  onlyRemoveTypeImports: true,
76
77
  disallowAmbiguousJSXLike: false
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.27.1",
4
+ "version": "5.27.2",
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": {
@@ -29,7 +29,7 @@
29
29
  "strip-json-comments": "^3.1.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@marko/translator-default": "^5.25.1"
32
+ "@marko/translator-default": "^5.25.2"
33
33
  },
34
34
  "files": [
35
35
  "dist",