@fairfox/polly 0.33.0 → 0.35.0
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.
|
@@ -438,8 +438,8 @@ class ProjectDetector {
|
|
|
438
438
|
return score;
|
|
439
439
|
}
|
|
440
440
|
detectMonorepo(packageJson) {
|
|
441
|
-
const workspacesRaw = packageJson
|
|
442
|
-
const patterns = Array.isArray(workspacesRaw) ? workspacesRaw : Array.isArray(workspacesRaw?.packages) ? workspacesRaw
|
|
441
|
+
const workspacesRaw = packageJson["workspaces"];
|
|
442
|
+
const patterns = Array.isArray(workspacesRaw) ? workspacesRaw : Array.isArray(workspacesRaw?.["packages"]) ? workspacesRaw["packages"] : [];
|
|
443
443
|
if (patterns.length === 0)
|
|
444
444
|
return null;
|
|
445
445
|
const workspaceDirs = this.resolveWorkspaceGlobs(patterns);
|
|
@@ -458,7 +458,7 @@ class ProjectDetector {
|
|
|
458
458
|
} catch {
|
|
459
459
|
continue;
|
|
460
460
|
}
|
|
461
|
-
const pkgName = wsPkg
|
|
461
|
+
const pkgName = wsPkg["name"] || path3.basename(wsDir);
|
|
462
462
|
const context = this.inferContextFromPackageName(pkgName);
|
|
463
463
|
const serverCandidates = [
|
|
464
464
|
"src/server.ts",
|
|
@@ -517,9 +517,9 @@ class ProjectDetector {
|
|
|
517
517
|
contextMapping,
|
|
518
518
|
workspacePackages,
|
|
519
519
|
metadata: {
|
|
520
|
-
name: packageJson
|
|
521
|
-
version: packageJson
|
|
522
|
-
description: packageJson
|
|
520
|
+
name: packageJson["name"],
|
|
521
|
+
version: packageJson["version"],
|
|
522
|
+
description: packageJson["description"]
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
525
|
}
|
|
@@ -2583,15 +2583,7 @@ class HandlerExtractor {
|
|
|
2583
2583
|
}
|
|
2584
2584
|
extractPropertyAssignment(prop, assignments, signalName) {
|
|
2585
2585
|
if (Node4.isPropertyAssignment(prop)) {
|
|
2586
|
-
|
|
2587
|
-
const initializer = prop.getInitializer();
|
|
2588
|
-
if (!name || !initializer)
|
|
2589
|
-
return;
|
|
2590
|
-
const value = this.extractValue(initializer);
|
|
2591
|
-
if (value === undefined)
|
|
2592
|
-
return;
|
|
2593
|
-
const field = signalName ? `${signalName}_${name}` : name;
|
|
2594
|
-
assignments.push({ field, value });
|
|
2586
|
+
this.extractRegularPropertyAssignment(prop, assignments, signalName);
|
|
2595
2587
|
return;
|
|
2596
2588
|
}
|
|
2597
2589
|
if (Node4.isShorthandPropertyAssignment(prop)) {
|
|
@@ -2604,6 +2596,37 @@ class HandlerExtractor {
|
|
|
2604
2596
|
}
|
|
2605
2597
|
}
|
|
2606
2598
|
}
|
|
2599
|
+
extractRegularPropertyAssignment(prop, assignments, signalName) {
|
|
2600
|
+
if (!Node4.isPropertyAssignment(prop))
|
|
2601
|
+
return;
|
|
2602
|
+
const name = prop.getName();
|
|
2603
|
+
const initializer = prop.getInitializer();
|
|
2604
|
+
if (!name || !initializer)
|
|
2605
|
+
return;
|
|
2606
|
+
const field = signalName ? `${signalName}_${name}` : name;
|
|
2607
|
+
const value = this.extractValue(initializer);
|
|
2608
|
+
if (value !== undefined) {
|
|
2609
|
+
assignments.push({ field, value });
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
const paramName = this.extractPayloadPropertyParam(initializer);
|
|
2613
|
+
if (paramName !== null) {
|
|
2614
|
+
assignments.push({ field, value: `param:${paramName}` });
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
extractPayloadPropertyParam(initializer) {
|
|
2618
|
+
if (!Node4.isPropertyAccessExpression(initializer))
|
|
2619
|
+
return null;
|
|
2620
|
+
const parts = this.getPropertyPath(initializer).split(".");
|
|
2621
|
+
if (parts.length !== 2)
|
|
2622
|
+
return null;
|
|
2623
|
+
const [paramName, fieldName] = parts;
|
|
2624
|
+
if (paramName === undefined || fieldName === undefined)
|
|
2625
|
+
return null;
|
|
2626
|
+
if (!this.currentFunctionParams.includes(paramName))
|
|
2627
|
+
return null;
|
|
2628
|
+
return fieldName;
|
|
2629
|
+
}
|
|
2607
2630
|
extractElementAccessAssignment(left, right, assignments) {
|
|
2608
2631
|
if (!Node4.isElementAccessExpression(left))
|
|
2609
2632
|
return;
|
|
@@ -3820,6 +3843,8 @@ class HandlerExtractor {
|
|
|
3820
3843
|
if (match) {
|
|
3821
3844
|
const signalName = match[1];
|
|
3822
3845
|
const fieldName = match[2];
|
|
3846
|
+
if (!signalName)
|
|
3847
|
+
return;
|
|
3823
3848
|
if (fieldName) {
|
|
3824
3849
|
signals.push(`${signalName}_${fieldName}`);
|
|
3825
3850
|
} else {
|
|
@@ -6212,4 +6237,4 @@ main().catch((_error) => {
|
|
|
6212
6237
|
process.exit(1);
|
|
6213
6238
|
});
|
|
6214
6239
|
|
|
6215
|
-
//# debugId=
|
|
6240
|
+
//# debugId=06FFF8A43205986564756E2164756E21
|