@marko/compiler 5.22.10 → 5.23.1
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/babel-plugin/file.js +10 -9
- package/dist/babel-plugin/index.js +10 -10
- package/dist/babel-plugin/parser.js +17 -17
- package/dist/babel-plugin/plugins/migrate.js +5 -5
- package/dist/babel-plugin/plugins/transform.js +5 -5
- package/dist/babel-types/generator/patch.js +2 -2
- package/dist/babel-types/traverse/patch.js +4 -4
- package/dist/babel-types/types/definitions.js +68 -68
- package/dist/babel-types/types/patch.js +2 -2
- package/dist/index.js +6 -6
- package/dist/register.js +2 -2
- package/dist/taglib/finder/index.js +2 -2
- package/dist/taglib/loader/Attribute.js +2 -2
- package/dist/taglib/loader/DependencyChain.js +2 -2
- package/dist/taglib/loader/Property.js +2 -2
- package/dist/taglib/loader/Tag.js +2 -2
- package/dist/taglib/loader/Taglib.js +4 -4
- package/dist/taglib/loader/Transformer.js +2 -2
- package/dist/taglib/loader/loadAttributeFromProps.js +4 -4
- package/dist/taglib/loader/loadTagFromProps.js +17 -17
- package/dist/taglib/loader/loadTaglibFromProps.js +6 -6
- package/dist/taglib/loader/scanTagsDir.js +4 -4
- package/dist/taglib/lookup/index.js +10 -10
- package/dist/traverse.d.ts +44 -24
- package/dist/types.d.ts +67 -45
- package/package.json +2 -2
|
@@ -43,8 +43,8 @@ function normalizeHook(dirname, value) {
|
|
|
43
43
|
path: value,
|
|
44
44
|
get hook() {
|
|
45
45
|
return markoModules.require(value);
|
|
46
|
-
}
|
|
47
|
-
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
48
|
}
|
|
49
49
|
return { hook: value };
|
|
50
50
|
}
|
|
@@ -74,9 +74,9 @@ class TagLoader {
|
|
|
74
74
|
"*": {
|
|
75
75
|
type: "string",
|
|
76
76
|
targetProperty: null,
|
|
77
|
-
preserveName: false
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
preserveName: false
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
propertyHandlers(tagProps, this, this.dependencyChain.toString());
|
|
@@ -89,8 +89,8 @@ class TagLoader {
|
|
|
89
89
|
|
|
90
90
|
if (typeof value === "string") {
|
|
91
91
|
nestedVariable = {
|
|
92
|
-
name: value
|
|
93
|
-
|
|
92
|
+
name: value
|
|
93
|
+
};
|
|
94
94
|
} else {
|
|
95
95
|
nestedVariable = {};
|
|
96
96
|
|
|
@@ -103,8 +103,8 @@ class TagLoader {
|
|
|
103
103
|
|
|
104
104
|
nameFromAttribute: function (value) {
|
|
105
105
|
nestedVariable.nameFromAttribute = value;
|
|
106
|
-
}
|
|
107
|
-
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
108
|
dependencyChain.toString());
|
|
109
109
|
|
|
110
110
|
|
|
@@ -216,16 +216,16 @@ class TagLoader {
|
|
|
216
216
|
} else if (typeof value === "string") {
|
|
217
217
|
if (hasNestedTag && hasAttr) {
|
|
218
218
|
tagProps = attrProps = {
|
|
219
|
-
type: value
|
|
220
|
-
|
|
219
|
+
type: value
|
|
220
|
+
};
|
|
221
221
|
} else if (hasNestedTag) {
|
|
222
222
|
tagProps = {
|
|
223
|
-
type: value
|
|
224
|
-
|
|
223
|
+
type: value
|
|
224
|
+
};
|
|
225
225
|
} else {
|
|
226
226
|
attrProps = {
|
|
227
|
-
type: value
|
|
228
|
-
|
|
227
|
+
type: value
|
|
228
|
+
};
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
@@ -528,8 +528,8 @@ class TagLoader {
|
|
|
528
528
|
|
|
529
529
|
featureFlags(value) {
|
|
530
530
|
this.tag.featureFlags = value;
|
|
531
|
-
}
|
|
532
|
-
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
533
|
|
|
534
534
|
function isSupportedProperty(name) {
|
|
535
535
|
return hasOwnProperty.call(TagLoader.prototype, name);
|
|
@@ -25,8 +25,8 @@ function normalizeHook(dirname, value) {
|
|
|
25
25
|
path: value,
|
|
26
26
|
get hook() {
|
|
27
27
|
return markoModules.require(value);
|
|
28
|
-
}
|
|
29
|
-
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
30
|
}
|
|
31
31
|
return { hook: value };
|
|
32
32
|
}
|
|
@@ -79,8 +79,8 @@ class TaglibLoader {
|
|
|
79
79
|
var pkg = jsonFileReader.readFileSync(packageJsonPath);
|
|
80
80
|
taglib.id = pkg.name;
|
|
81
81
|
} catch (e) {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
|
|
83
|
+
/* ignore error */}
|
|
84
84
|
|
|
85
85
|
if (!taglib.id) {
|
|
86
86
|
taglib.id = filePath;
|
|
@@ -381,8 +381,8 @@ class TaglibLoader {
|
|
|
381
381
|
attrGroup[attrName] = attr;
|
|
382
382
|
});
|
|
383
383
|
});
|
|
384
|
-
}
|
|
385
|
-
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
386
|
|
|
387
387
|
function loadTaglibFromProps(taglib, taglibProps, dependencyChain) {
|
|
388
388
|
ok(taglib, '"taglib" is required');
|
|
@@ -45,8 +45,8 @@ function merge(target, source) {
|
|
|
45
45
|
class TaglibLookup {
|
|
46
46
|
constructor() {
|
|
47
47
|
this.merged = {
|
|
48
|
-
attributeGroups: {}
|
|
49
|
-
|
|
48
|
+
attributeGroups: {}
|
|
49
|
+
};
|
|
50
50
|
this.taglibsById = {};
|
|
51
51
|
|
|
52
52
|
this._sortedTags = undefined;
|
|
@@ -105,8 +105,8 @@ class TaglibLookup {
|
|
|
105
105
|
tags: taglib.tags,
|
|
106
106
|
attributes: taglib.attributes,
|
|
107
107
|
patternAttributes: taglib.patternAttributes,
|
|
108
|
-
attributeGroups: taglib.attributeGroups || {}
|
|
109
|
-
|
|
108
|
+
attributeGroups: taglib.attributeGroups || {}
|
|
109
|
+
});
|
|
110
110
|
|
|
111
111
|
this._mergeNestedTags(taglib);
|
|
112
112
|
}
|
|
@@ -192,14 +192,14 @@ class TaglibLookup {
|
|
|
192
192
|
getAttribute(element, attr) {
|
|
193
193
|
if (typeof element === "string") {
|
|
194
194
|
element = {
|
|
195
|
-
tagName: element
|
|
196
|
-
|
|
195
|
+
tagName: element
|
|
196
|
+
};
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
if (typeof attr === "string") {
|
|
200
200
|
attr = {
|
|
201
|
-
name: attr
|
|
202
|
-
|
|
201
|
+
name: attr
|
|
202
|
+
};
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
var tags = this.merged.tags;
|
|
@@ -271,7 +271,7 @@ class TaglibLookup {
|
|
|
271
271
|
|
|
272
272
|
toString() {
|
|
273
273
|
return "lookup: " + Object.keys(this.taglibsById).join(", ");
|
|
274
|
-
}
|
|
275
|
-
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
276
|
|
|
277
277
|
module.exports = TaglibLookup;
|
package/dist/traverse.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for @babel/traverse 7.
|
|
1
|
+
// Type definitions for @babel/traverse 7.18
|
|
2
2
|
// Project: https://github.com/babel/babel/tree/main/packages/babel-traverse, https://babeljs.io
|
|
3
3
|
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
|
4
4
|
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
|
@@ -106,7 +106,7 @@ export class Scope {
|
|
|
106
106
|
/** Possibly generate a memoised identifier if it is not static and has consequences. */
|
|
107
107
|
maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier;
|
|
108
108
|
|
|
109
|
-
checkBlockScopedCollisions(local:
|
|
109
|
+
checkBlockScopedCollisions(local: Binding, kind: BindingKind, name: string, id: object): void;
|
|
110
110
|
|
|
111
111
|
rename(oldName: string, newName?: string, block?: Node): void;
|
|
112
112
|
|
|
@@ -180,23 +180,30 @@ export class Scope {
|
|
|
180
180
|
removeBinding(name: string): void;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
export type BindingKind = 'var' | 'let' | 'const' | 'module' | 'hoisted' | 'param' | 'local' | 'unknown';
|
|
184
|
+
|
|
183
185
|
export class Binding {
|
|
184
|
-
constructor(opts: {
|
|
185
|
-
existing: Binding;
|
|
186
|
-
identifier: t.Identifier;
|
|
187
|
-
scope: Scope;
|
|
188
|
-
path: NodePath;
|
|
189
|
-
kind: 'var' | 'let' | 'const';
|
|
190
|
-
});
|
|
186
|
+
constructor(opts: { identifier: t.Identifier; scope: Scope; path: NodePath; kind: BindingKind });
|
|
191
187
|
identifier: t.Identifier;
|
|
192
188
|
scope: Scope;
|
|
193
189
|
path: NodePath;
|
|
194
|
-
kind:
|
|
190
|
+
kind: BindingKind;
|
|
195
191
|
referenced: boolean;
|
|
196
192
|
references: number;
|
|
197
193
|
referencePaths: NodePath[];
|
|
198
194
|
constant: boolean;
|
|
199
195
|
constantViolations: NodePath[];
|
|
196
|
+
hasDeoptedValue?: boolean;
|
|
197
|
+
hasValue?: boolean;
|
|
198
|
+
value?: any;
|
|
199
|
+
|
|
200
|
+
deopValue(): void;
|
|
201
|
+
setValue(value: any): void;
|
|
202
|
+
clearValue(): void;
|
|
203
|
+
|
|
204
|
+
reassign(path: NodePath): void;
|
|
205
|
+
reference(path: NodePath): void;
|
|
206
|
+
dereference(): void;
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
export type Visitor<S = {}> = VisitNodeObject<S, Node> & {
|
|
@@ -495,7 +502,7 @@ export class NodePath<T = Node> {
|
|
|
495
502
|
|
|
496
503
|
setScope(): void;
|
|
497
504
|
|
|
498
|
-
setContext(context
|
|
505
|
+
setContext(context?: TraversalContext): this;
|
|
499
506
|
|
|
500
507
|
popContext(): void;
|
|
501
508
|
|
|
@@ -548,21 +555,30 @@ export class NodePath<T = Node> {
|
|
|
548
555
|
getAllPrevSiblings(): NodePath[];
|
|
549
556
|
getAllNextSiblings(): NodePath[];
|
|
550
557
|
|
|
551
|
-
get<K extends keyof T>(
|
|
552
|
-
key: K,
|
|
553
|
-
context?: boolean | TraversalContext,
|
|
554
|
-
): T[K] extends Array<Node | null | undefined>
|
|
555
|
-
? Array<NodePath<T[K][number]>>
|
|
556
|
-
: T[K] extends Array<Node | null | undefined> | null | undefined
|
|
557
|
-
? Array<NodePath<NonNullable<T[K]>[number]>> | NodePath<null | undefined>
|
|
558
|
-
: T[K] extends Node | null | undefined
|
|
559
|
-
? NodePath<T[K]>
|
|
560
|
-
: never;
|
|
558
|
+
get<K extends keyof T>(key: K, context?: boolean | TraversalContext): NodePathResult<T[K]>;
|
|
561
559
|
|
|
562
560
|
|
|
563
|
-
getBindingIdentifiers(duplicates
|
|
564
|
-
|
|
565
|
-
|
|
561
|
+
getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
|
|
562
|
+
getBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
|
|
563
|
+
getBindingIdentifiers(duplicates?: boolean): Record<string, t.Identifier | t.Identifier[]>;
|
|
564
|
+
|
|
565
|
+
getOuterBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>;
|
|
566
|
+
getOuterBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>;
|
|
567
|
+
getOuterBindingIdentifiers(duplicates?: boolean): Record<string, t.Identifier | t.Identifier[]>;
|
|
568
|
+
|
|
569
|
+
getBindingIdentifierPaths(duplicates: true, outerOnly?: boolean): Record<string, Array<NodePath<t.Identifier>>>;
|
|
570
|
+
getBindingIdentifierPaths(duplicates?: false, outerOnly?: boolean): Record<string, NodePath<t.Identifier>>;
|
|
571
|
+
getBindingIdentifierPaths(
|
|
572
|
+
duplicates?: boolean,
|
|
573
|
+
outerOnly?: boolean,
|
|
574
|
+
): Record<string, NodePath<t.Identifier> | Array<NodePath<t.Identifier>>>;
|
|
575
|
+
|
|
576
|
+
getOuterBindingIdentifierPaths(duplicates: true): Record<string, Array<NodePath<t.Identifier>>>;
|
|
577
|
+
getOuterBindingIdentifierPaths(duplicates?: false): Record<string, NodePath<t.Identifier>>;
|
|
578
|
+
getOuterBindingIdentifierPaths(
|
|
579
|
+
duplicates?: boolean,
|
|
580
|
+
outerOnly?: boolean,
|
|
581
|
+
): Record<string, NodePath<t.Identifier> | Array<NodePath<t.Identifier>>>;
|
|
566
582
|
//#endregion
|
|
567
583
|
|
|
568
584
|
//#region ------------------------- comments -------------------------
|
|
@@ -1220,3 +1236,7 @@ export interface TraversalContext {
|
|
|
1220
1236
|
state: any;
|
|
1221
1237
|
opts: any;
|
|
1222
1238
|
}
|
|
1239
|
+
|
|
1240
|
+
export type NodePathResult<T> =
|
|
1241
|
+
| (Extract<T, Node | null | undefined> extends never ? never : NodePath<Extract<T, Node | null | undefined>>)
|
|
1242
|
+
| (T extends Array<Node | null | undefined> ? Array<NodePath<T[number]>> : never);
|