@marko/compiler 5.23.0 → 5.23.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.
@@ -17,16 +17,16 @@ class MarkoFile extends _core.File {
17
17
  {
18
18
  start: {
19
19
  line: loc.start.line,
20
- column: loc.start.column + 1 },
21
-
20
+ column: loc.start.column + 1
21
+ },
22
22
  end:
23
23
  loc.end && loc.start.line === loc.end.line ?
24
24
  {
25
25
  line: loc.end.line,
26
- column: loc.end.column + 1 } :
27
-
28
- undefined },
29
-
26
+ column: loc.end.column + 1
27
+ } :
28
+ undefined
29
+ },
30
30
  { highlightCode: true });
31
31
 
32
32
 
@@ -41,7 +41,8 @@ class MarkoFile extends _core.File {
41
41
  get() {
42
42
  return finalMsg;
43
43
  },
44
- set() {} });
45
-
44
+ set() {}
45
+ });
46
46
  return err;
47
- }}exports.MarkoFile = MarkoFile;
47
+ }
48
+ }exports.MarkoFile = MarkoFile;
@@ -106,8 +106,8 @@ const SOURCE_FILES = new WeakMap();var _default =
106
106
  } finally {
107
107
  (0, _fs.setFS)(prevFS);
108
108
  }
109
- } };
110
-
109
+ }
110
+ };
111
111
  };exports.default = _default;
112
112
 
113
113
  function getMarkoFile(code, fileOpts, markoOpts) {
@@ -163,18 +163,18 @@ function getMarkoFile(code, fileOpts, markoOpts) {
163
163
  type: "Program",
164
164
  sourceType: "module",
165
165
  body: [],
166
- directives: [] } } });
167
-
168
-
169
-
166
+ directives: []
167
+ }
168
+ }
169
+ });
170
170
 
171
171
  const meta = file.metadata.marko = {
172
172
  id,
173
173
  macros: {},
174
174
  deps: [],
175
175
  tags: [],
176
- watchFiles: [] };
177
-
176
+ watchFiles: []
177
+ };
178
178
 
179
179
  file.markoOpts = markoOpts;
180
180
  file.___taglibLookup = taglibLookup;
@@ -226,8 +226,8 @@ function getMarkoFile(code, fileOpts, markoOpts) {
226
226
  compileCache.set(cacheKey, {
227
227
  time: Date.now(),
228
228
  file,
229
- contentHash });
230
-
229
+ contentHash
230
+ });
231
231
 
232
232
  if (translator.analyze) {
233
233
  try {
@@ -12,8 +12,8 @@ const isAttrTag = (tag) => {var _tag$name$value;return ((_tag$name$value = tag.n
12
12
  const toBabelPosition = ({ line, character }) => ({
13
13
  // Babel lines start at 1 and use "column" instead of "character".
14
14
  line: line + 1,
15
- column: character });
16
-
15
+ column: character
16
+ });
17
17
 
18
18
  function parseMarko(file) {
19
19
  const { code } = file;
@@ -32,8 +32,8 @@ function parseMarko(file) {
32
32
  const { start, end } = parser.locationAt(range);
33
33
  return {
34
34
  start: toBabelPosition(start),
35
- end: toBabelPosition(end) };
36
-
35
+ end: toBabelPosition(end)
36
+ };
37
37
  };
38
38
  const withLoc = (node, range) => {
39
39
  node.start = range.start;
@@ -72,8 +72,8 @@ function parseMarko(file) {
72
72
  [
73
73
  t.templateElement({
74
74
  raw: result.value,
75
- cooked: result.value })],
76
-
75
+ cooked: result.value
76
+ })],
77
77
 
78
78
  []);
79
79
 
@@ -171,8 +171,8 @@ function parseMarko(file) {
171
171
  const trimmedStart = part.start + rawValue.indexOf(value);
172
172
  withLoc(node, {
173
173
  start: trimmedStart,
174
- end: trimmedStart + rawValue.length });
175
-
174
+ end: trimmedStart + rawValue.length
175
+ });
176
176
  } else {
177
177
  body.splice(body.indexOf(node), 1);
178
178
  }
@@ -376,8 +376,8 @@ function parseMarko(file) {
376
376
  start: currentShorthandClassNames[0].start,
377
377
  end: currentShorthandClassNames[
378
378
  currentShorthandClassNames.length - 1].
379
- end }) :
380
-
379
+ end
380
+ }) :
381
381
 
382
382
  t.arrayExpression(currentShorthandClassNames);
383
383
 
@@ -431,8 +431,8 @@ function parseMarko(file) {
431
431
  if (parseOptions.rawOpenTag) {
432
432
  node.rawValue = parser.read({
433
433
  start: node.name.start,
434
- end: part.start });
435
-
434
+ end: part.start
435
+ });
436
436
  }
437
437
 
438
438
  if (
@@ -471,8 +471,8 @@ function parseMarko(file) {
471
471
  }
472
472
 
473
473
  onNext();
474
- } });
475
-
474
+ }
475
+ });
476
476
 
477
477
  parser.parse(code);
478
478
  onNext();
@@ -483,6 +483,6 @@ function parseMarko(file) {
483
483
  ast.end = program.end = code.length - 1;
484
484
  ast.loc = program.loc = {
485
485
  start: { line: 1, column: 0 },
486
- end: positionAt(ast.end) };
487
-
486
+ end: positionAt(ast.end)
487
+ };
488
488
  }
@@ -22,14 +22,14 @@ const visitor = {
22
22
  (0, _pluginHooks.exit)(migrator, path, t);
23
23
  if (path.node !== node) break; // Stop if node is replaced.
24
24
  }
25
- } } };exports.visitor = visitor;
26
-
27
-
25
+ }
26
+ }
27
+ };exports.visitor = visitor;
28
28
 
29
29
  function getMigratorsForTag(path) {
30
30
  const {
31
- hub: { file } } =
32
- path;
31
+ hub: { file }
32
+ } = path;
33
33
  const { watchFiles } = file.metadata.marko;
34
34
  const tagName = path.get("name.value").node || "*";
35
35
  const MIGRATOR_CACHE = file.MIGRATOR_CACHE =
@@ -24,14 +24,14 @@ const visitor = {
24
24
  (0, _pluginHooks.exit)(transformer, path, t);
25
25
  if (path.node !== node) break; // Stop if node is replaced.
26
26
  }
27
- } } };exports.visitor = visitor;
28
-
29
-
27
+ }
28
+ }
29
+ };exports.visitor = visitor;
30
30
 
31
31
  function getTransformersForTag(path) {
32
32
  const {
33
- hub: { file } } =
34
- path;
33
+ hub: { file }
34
+ } = path;
35
35
  const { watchFiles } = file.metadata.marko;
36
36
  const tagName = path.get("name.value").node || "*";
37
37
  const TRANSFORMER_CACHE = file.TRANSFORMER_CACHE =
@@ -217,8 +217,8 @@ Object.assign(_printer.default.prototype, {
217
217
  }
218
218
  this.token(">");
219
219
  }
220
- } });
221
-
220
+ }
221
+ });
222
222
 
223
223
  function spaceSeparator() {
224
224
  this.token(" ");
@@ -68,14 +68,14 @@ _traverse.Scope.prototype.crawl = function () {
68
68
  binding;
69
69
  } else {
70
70
  state.hoistableTagVarsByScope.set(curScope, {
71
- [name]: binding });
72
-
71
+ [name]: binding
72
+ });
73
73
  }
74
74
  }
75
75
  }
76
76
  }
77
- } }));
78
-
77
+ }
78
+ }));
79
79
 
80
80
  }
81
81
 
@@ -9,40 +9,40 @@
9
9
  var _core = require("@babel/types/lib/definitions/core");
10
10
  const valueFieldCommon = {
11
11
  value: {
12
- validate: (0, _utils.assertValueType)("string") } };
13
-
14
-
12
+ validate: (0, _utils.assertValueType)("string")
13
+ }
14
+ };
15
15
 
16
16
  const MarkoDefinitions = {
17
17
  MarkoDocumentType: {
18
18
  aliases: ["Marko", "Statement"],
19
19
  builder: ["value"],
20
- fields: { ...valueFieldCommon } },
21
-
20
+ fields: { ...valueFieldCommon }
21
+ },
22
22
 
23
23
  MarkoDeclaration: {
24
24
  aliases: ["Marko", "Statement"],
25
25
  builder: ["value"],
26
- fields: { ...valueFieldCommon } },
27
-
26
+ fields: { ...valueFieldCommon }
27
+ },
28
28
 
29
29
  MarkoCDATA: {
30
30
  aliases: ["Marko", "Statement"],
31
31
  builder: ["value"],
32
- fields: { ...valueFieldCommon } },
33
-
32
+ fields: { ...valueFieldCommon }
33
+ },
34
34
 
35
35
  MarkoComment: {
36
36
  aliases: ["Marko", "Statement"],
37
37
  builder: ["value"],
38
- fields: { ...valueFieldCommon } },
39
-
38
+ fields: { ...valueFieldCommon }
39
+ },
40
40
 
41
41
  MarkoText: {
42
42
  aliases: ["Marko", "Statement"],
43
43
  builder: ["value"],
44
- fields: { ...valueFieldCommon } },
45
-
44
+ fields: { ...valueFieldCommon }
45
+ },
46
46
 
47
47
  MarkoPlaceholder: {
48
48
  aliases: ["Marko", "Statement"],
@@ -50,14 +50,14 @@ const MarkoDefinitions = {
50
50
  visitor: ["value"],
51
51
  fields: {
52
52
  value: {
53
- validate: (0, _utils.assertNodeType)("Expression") },
54
-
53
+ validate: (0, _utils.assertNodeType)("Expression")
54
+ },
55
55
  escape: {
56
56
  validate: (0, _utils.assertValueType)("boolean"),
57
- default: true } } },
58
-
59
-
60
-
57
+ default: true
58
+ }
59
+ }
60
+ },
61
61
 
62
62
  MarkoScriptlet: {
63
63
  aliases: ["Marko", "Statement"],
@@ -65,14 +65,14 @@ const MarkoDefinitions = {
65
65
  visitor: ["body"],
66
66
  fields: {
67
67
  body: {
68
- validate: (0, _utils.arrayOfType)(["Statement"]) },
69
-
68
+ validate: (0, _utils.arrayOfType)(["Statement"])
69
+ },
70
70
  static: {
71
71
  validate: (0, _utils.assertValueType)("boolean"),
72
- default: false } } },
73
-
74
-
75
-
72
+ default: false
73
+ }
74
+ }
75
+ },
76
76
 
77
77
  MarkoClass: {
78
78
  aliases: ["Marko", "Statement"],
@@ -80,10 +80,10 @@ const MarkoDefinitions = {
80
80
  visitor: ["body"],
81
81
  fields: {
82
82
  body: {
83
- validate: (0, _utils.assertNodeType)("ClassBody") } } },
84
-
85
-
86
-
83
+ validate: (0, _utils.assertNodeType)("ClassBody")
84
+ }
85
+ }
86
+ },
87
87
 
88
88
  MarkoAttribute: {
89
89
  aliases: ["Marko"],
@@ -91,32 +91,32 @@ const MarkoDefinitions = {
91
91
  visitor: ["value", "arguments"],
92
92
  fields: {
93
93
  name: {
94
- validate: (0, _utils.assertValueType)("string") },
95
-
94
+ validate: (0, _utils.assertValueType)("string")
95
+ },
96
96
  value: {
97
- validate: (0, _utils.assertNodeType)("Expression") },
98
-
97
+ validate: (0, _utils.assertNodeType)("Expression")
98
+ },
99
99
  modifier: {
100
100
  validate: (0, _utils.assertValueType)("string"),
101
- optional: true },
102
-
101
+ optional: true
102
+ },
103
103
  arguments: {
104
104
  validate: (0, _utils.chain)(
105
105
  (0, _utils.assertValueType)("array"),
106
106
  (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement"))),
107
107
 
108
- optional: true },
109
-
108
+ optional: true
109
+ },
110
110
  default: {
111
111
  validate: (0, _utils.assertValueType)("boolean"),
112
- optional: true },
113
-
112
+ optional: true
113
+ },
114
114
  bound: {
115
115
  validate: (0, _utils.assertValueType)("boolean"),
116
- optional: true } } },
117
-
118
-
119
-
116
+ optional: true
117
+ }
118
+ }
119
+ },
120
120
 
121
121
  MarkoSpreadAttribute: {
122
122
  aliases: ["Marko"],
@@ -124,10 +124,10 @@ const MarkoDefinitions = {
124
124
  visitor: ["value"],
125
125
  fields: {
126
126
  value: {
127
- validate: (0, _utils.assertNodeType)("Expression") } } },
128
-
129
-
130
-
127
+ validate: (0, _utils.assertNodeType)("Expression")
128
+ }
129
+ }
130
+ },
131
131
 
132
132
  MarkoTagBody: {
133
133
  aliases: ["Marko", "BlockParent", "Scope"],
@@ -136,8 +136,8 @@ const MarkoDefinitions = {
136
136
  fields: {
137
137
  params: {
138
138
  ..._core.functionCommon.params,
139
- default: [] },
140
-
139
+ default: []
140
+ },
141
141
  body: {
142
142
  validate: (0, _utils.arrayOfType)([
143
143
  "MarkoTag",
@@ -147,10 +147,10 @@ const MarkoDefinitions = {
147
147
  "MarkoScriptlet",
148
148
  "MarkoComment"]),
149
149
 
150
- default: [] } } },
151
-
152
-
153
-
150
+ default: []
151
+ }
152
+ }
153
+ },
154
154
 
155
155
  MarkoTag: {
156
156
  aliases: ["Marko", "Statement"],
@@ -158,33 +158,33 @@ const MarkoDefinitions = {
158
158
  visitor: ["name", "attributes", "body", "arguments", "var"],
159
159
  fields: {
160
160
  name: {
161
- validate: (0, _utils.assertNodeType)("Expression") },
162
-
161
+ validate: (0, _utils.assertNodeType)("Expression")
162
+ },
163
163
  attributes: {
164
164
  validate: (0, _utils.arrayOfType)(["MarkoAttribute", "MarkoSpreadAttribute"]),
165
- default: [] },
166
-
165
+ default: []
166
+ },
167
167
  body: {
168
- validate: (0, _utils.assertNodeType)("MarkoTagBody") },
169
-
168
+ validate: (0, _utils.assertNodeType)("MarkoTagBody")
169
+ },
170
170
  arguments: {
171
171
  validate: (0, _utils.chain)(
172
172
  (0, _utils.assertValueType)("array"),
173
173
  (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement"))),
174
174
 
175
- optional: true },
176
-
175
+ optional: true
176
+ },
177
177
  rawValue: {
178
178
  validate: (0, _utils.assertValueType)("string"),
179
- optional: true },
180
-
179
+ optional: true
180
+ },
181
181
  var: {
182
182
  validate: (0, _utils.assertNodeType)("LVal"),
183
- optional: true } } } };var _default =
184
-
185
-
186
-
187
-
183
+ optional: true
184
+ }
185
+ }
186
+ }
187
+ };var _default =
188
188
 
189
189
  MarkoDefinitions;exports.default = _default;
190
190
  const MARKO_TYPES = Object.keys(MarkoDefinitions);exports.MARKO_TYPES = MARKO_TYPES;
@@ -12,8 +12,8 @@ const {
12
12
  FLIPPED_ALIAS_KEYS,
13
13
  DEPRECATED_KEYS,
14
14
  is,
15
- getBindingIdentifiers } =
16
- babelTypes;
15
+ getBindingIdentifiers
16
+ } = babelTypes;
17
17
 
18
18
  getBindingIdentifiers.keys["MarkoTag"] = ["var"];
19
19
  getBindingIdentifiers.keys["MarkoTagBody"] = ["params"];
package/dist/index.js CHANGED
@@ -73,8 +73,8 @@ function loadBabelConfig(filename, config) {
73
73
  allowNamespaces: true,
74
74
  optimizeConstEnums: true,
75
75
  onlyRemoveTypeImports: true,
76
- disallowAmbiguousJSXLike: false }]];
77
-
76
+ disallowAmbiguousJSXLike: false
77
+ }]];
78
78
 
79
79
 
80
80
  const baseBabelConfig = {
@@ -87,8 +87,8 @@ function loadBabelConfig(filename, config) {
87
87
  sourceType: "module",
88
88
  sourceMaps: markoConfig.sourceMaps,
89
89
  code: markoConfig.code,
90
- ast: markoConfig.ast };
91
-
90
+ ast: markoConfig.ast
91
+ };
92
92
 
93
93
  if (markoConfig.modules === "cjs") {
94
94
  requiredPlugins.push([_pluginTransformModulesCommonjs.default, { loose: true }]);
@@ -106,8 +106,8 @@ function buildResult(babelResult) {
106
106
  ast,
107
107
  map,
108
108
  code,
109
- metadata: { marko: meta } } =
110
- babelResult;
109
+ metadata: { marko: meta }
110
+ } = babelResult;
111
111
  return { ast, map, code, meta };
112
112
  }
113
113
 
package/dist/register.js CHANGED
@@ -18,8 +18,8 @@ function register({ extensions = require.extensions, ...options } = {}) {
18
18
  meta: true,
19
19
  hot: process.env.BROWSER_REFRESH_URL !== undefined,
20
20
  // eslint-disable-next-line no-constant-condition
21
- sourceMaps: isDev ? "inline" : false },
22
-
21
+ sourceMaps: isDev ? "inline" : false
22
+ },
23
23
  options,
24
24
  requiredOptions)).
25
25
 
@@ -69,8 +69,8 @@ function find(dirname, registeredTaglibs) {
69
69
  added[taglib.id] = true;
70
70
  found.push(taglib);
71
71
  },
72
- foundTaglibPackages: {} };
73
-
72
+ foundTaglibPackages: {}
73
+ };
74
74
 
75
75
  var rootDirname = process.cwd(); // Don't search up past this directory
76
76
  var rootPkg = getModuleRootPackage(dirname);
@@ -9,7 +9,7 @@ class Attribute {
9
9
  this.allowExpressions = true;
10
10
  this.setFlag = null;
11
11
  this.pattern = null;
12
- }}
13
-
12
+ }
13
+ }
14
14
 
15
15
  module.exports = Attribute;
@@ -11,7 +11,7 @@ class DependencyChain {
11
11
 
12
12
  toString() {
13
13
  return "[" + this.array.join(" → ") + "]";
14
- }}
15
-
14
+ }
15
+ }
16
16
 
17
17
  module.exports = DependencyChain;
@@ -5,7 +5,7 @@ class Property {
5
5
  this.name = null;
6
6
  this.type = "string";
7
7
  this.value = undefined;
8
- }}
9
-
8
+ }
9
+ }
10
10
 
11
11
  module.exports = Property;
@@ -94,7 +94,7 @@ class Tag {
94
94
  setTaglib(taglib) {
95
95
  this.taglibId = taglib ? taglib.id : null;
96
96
  this.taglibPath = taglib ? taglib.path : null;
97
- }}
98
-
97
+ }
98
+ }
99
99
 
100
100
  module.exports = Tag;
@@ -84,9 +84,9 @@ class Taglib {
84
84
  tags: this.tags,
85
85
  attributes: this.attributes,
86
86
  patternAttributes: this.patternAttributes,
87
- imports: this.imports };
88
-
89
- }}
90
-
87
+ imports: this.imports
88
+ };
89
+ }
90
+ }
91
91
 
92
92
  module.exports = Taglib;
@@ -12,7 +12,7 @@ class Transformer {
12
12
 
13
13
  toString() {
14
14
  return "[Taglib.Transformer: " + this.path + "]";
15
- }}
16
-
15
+ }
16
+ }
17
17
 
18
18
  module.exports = Transformer;
@@ -23,8 +23,8 @@ class AttrLoader {
23
23
  attrProps = {};
24
24
  } else if (typeof attrProps === "string") {
25
25
  attrProps = {
26
- type: attrProps };
27
-
26
+ type: attrProps
27
+ };
28
28
  } else {
29
29
  assert.ok(typeof attrProps === "object", 'Invalid "attrProps"');
30
30
  }
@@ -208,8 +208,8 @@ class AttrLoader {
208
208
 
209
209
  html(value) {
210
210
  this.attr.html = value === true;
211
- }}
212
-
211
+ }
212
+ }
213
213
 
214
214
  function loadAttributeFromProps(attrName, attrProps, dependencyChain) {
215
215
  assert.ok(typeof attrName === "string");