gitnexus 1.6.6-rc.94 → 1.6.6-rc.95
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.
|
@@ -69,21 +69,38 @@ const NEW_QUALIFIED_CTOR_SPEC = {
|
|
|
69
69
|
// proto loader). Matches either a bare call or an `obj.loadPackageDefinition(...)`
|
|
70
70
|
// call. Plugin gates the qualified-constructor consumer on this —
|
|
71
71
|
// structural check avoids materializing `tree.rootNode.text` for every file.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
//
|
|
73
|
+
// These are TWO separate specs, NOT one `function: [ (identifier) ... (member_expression) ... ]`
|
|
74
|
+
// alternation. Under the pinned tree-sitter@0.21.1 binding a top-level alternation
|
|
75
|
+
// whose branches reuse the same capture name (`@fn`) collapses to one pattern with
|
|
76
|
+
// a shared predicate bucket; the second branch's `@fn` is left unbound and its
|
|
77
|
+
// `#eq?` is never enforced, so the member-expression branch would match EVERY
|
|
78
|
+
// `obj.method(...)` call (e.g. `console.log(...)`) — turning this gate always-on
|
|
79
|
+
// and emitting spurious qualified-constructor consumers. Two specs compile to two
|
|
80
|
+
// queries with independent predicate buckets; `runCompiledPatterns` concatenates
|
|
81
|
+
// their matches, so the `.length > 0` gate still means "either form is present".
|
|
82
|
+
const LOAD_PACKAGE_DEFINITION_SPECS = [
|
|
83
|
+
{
|
|
84
|
+
meta: {},
|
|
85
|
+
query: `
|
|
86
|
+
(call_expression
|
|
87
|
+
function: (identifier) @fn (#eq? @fn "loadPackageDefinition"))
|
|
88
|
+
`,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
meta: {},
|
|
92
|
+
query: `
|
|
93
|
+
(call_expression
|
|
94
|
+
function: (member_expression
|
|
95
|
+
property: (property_identifier) @fn (#eq? @fn "loadPackageDefinition")))
|
|
96
|
+
`,
|
|
97
|
+
},
|
|
98
|
+
];
|
|
82
99
|
function compileBundle(language, name) {
|
|
83
100
|
const mk = (spec, suffix) => compilePatterns({
|
|
84
101
|
name: `${name}-${suffix}`,
|
|
85
102
|
language,
|
|
86
|
-
patterns: [spec],
|
|
103
|
+
patterns: Array.isArray(spec) ? spec : [spec],
|
|
87
104
|
});
|
|
88
105
|
return {
|
|
89
106
|
grpcMethod: mk(GRPC_METHOD_SPEC, 'grpc-method'),
|
|
@@ -91,7 +108,7 @@ function compileBundle(language, name) {
|
|
|
91
108
|
getService: mk(GET_SERVICE_SPEC, 'get-service'),
|
|
92
109
|
newSimpleCtor: mk(NEW_SIMPLE_CTOR_SPEC, 'new-simple-ctor'),
|
|
93
110
|
newQualifiedCtor: mk(NEW_QUALIFIED_CTOR_SPEC, 'new-qualified-ctor'),
|
|
94
|
-
loadPackageDefinition: mk(
|
|
111
|
+
loadPackageDefinition: mk(LOAD_PACKAGE_DEFINITION_SPECS, 'load-package-definition'),
|
|
95
112
|
};
|
|
96
113
|
}
|
|
97
114
|
const JAVASCRIPT_BUNDLE = compileBundle(JavaScript, 'javascript-grpc');
|
package/package.json
CHANGED