@marko/compiler 5.35.7 → 5.35.9

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/babel-types.d.ts CHANGED
@@ -4,3 +4,9 @@ export * from "./dist/types";
4
4
  export * from "./dist/traverse";
5
5
  export { Scope };
6
6
  export const MARKO_TYPES: string[];
7
+
8
+ declare module "./dist/types" {
9
+ interface Program {
10
+ params: Identifier[];
11
+ }
12
+ }
@@ -200,7 +200,8 @@ function getMarkoFile(code, fileOpts, markoOpts) {
200
200
  type: "Program",
201
201
  sourceType: "module",
202
202
  body: [],
203
- directives: []
203
+ directives: [],
204
+ params: [t.identifier("input")]
204
205
  }
205
206
  }
206
207
  });
@@ -79,6 +79,10 @@ _traverse.Scope.prototype.crawl = function () {
79
79
  );
80
80
  }
81
81
 
82
+ if (this.type === "Program" && this.node.params?.length) {
83
+ this.scope.registerBinding("params", this);
84
+ }
85
+
82
86
  this.traverse(visitor, state);
83
87
 
84
88
  if (state.references.length) {
@@ -15,13 +15,17 @@ const {
15
15
  getBindingIdentifiers
16
16
  } = babelTypes;
17
17
 
18
- getBindingIdentifiers.keys["MarkoTag"] = ["var"];
19
- getBindingIdentifiers.keys["MarkoTagBody"] = ["params"];
18
+ getBindingIdentifiers.keys.Program = ["params"];
19
+ getBindingIdentifiers.keys.MarkoTag = ["var"];
20
+ getBindingIdentifiers.keys.MarkoTagBody = ["params"];
20
21
 
21
22
  _definitions.MARKO_TYPES.forEach((typeName) => {
22
23
  (0, _utils.default)(typeName, _definitions.default[typeName]);
23
24
  });
24
25
 
26
+ babelTypes.NODE_FIELDS.Program.params =
27
+ babelTypes.NODE_FIELDS.MarkoTagBody.params;
28
+
25
29
  for (const type of [
26
30
  ...Object.keys(VISITOR_KEYS),
27
31
  ...Object.keys(FLIPPED_ALIAS_KEYS),
package/dist/types.d.ts CHANGED
@@ -262,6 +262,7 @@ export interface Program extends BaseNode {
262
262
  directives: Array<Directive>;
263
263
  sourceType: "script" | "module";
264
264
  interpreter: InterpreterDirective | null;
265
+ params: Array<Identifier | Pattern | RestElement>;
265
266
  }
266
267
 
267
268
  export interface ObjectExpression extends BaseNode {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
- "version": "5.35.7",
3
+ "version": "5.35.9",
4
4
  "description": "Marko template to JS compiler.",
5
5
  "keywords": [
6
6
  "babel",
@@ -80,7 +80,7 @@
80
80
  "source-map-support": "^0.5.21"
81
81
  },
82
82
  "devDependencies": {
83
- "@marko/translator-default": "^5.32.8"
83
+ "@marko/translator-default": "^5.32.10"
84
84
  },
85
85
  "publishConfig": {
86
86
  "access": "public"