@uipath/packager-tool-workflowcompiler 1.199.0-preview.97 → 1.200.0-preview.109
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/i18n/locales/en.d.ts +1 -1
- package/dist/index.js +87 -28
- package/dist/workflow-compiler-config.d.ts +2 -0
- package/dist/workflow-compiler-tool-factory.d.ts +12 -0
- package/dist/workflow-compiler-tool.d.ts +2 -0
- package/package.json +3 -3
- package/src/workflow-compiler-config.ts +4 -1
- package/src/workflow-compiler-path-resolver.ts +1 -2
- package/src/workflow-compiler-tool-factory.ts +23 -1
- package/src/workflow-compiler-tool.ts +90 -0
|
@@ -28,7 +28,7 @@ export declare const en: {
|
|
|
28
28
|
readonly checkingNuGetCache: "[PathResolver] Checking NuGet cache: {path}";
|
|
29
29
|
readonly foundInNuGetCache: "[PathResolver] Found compiler in NuGet cache";
|
|
30
30
|
readonly notFoundStartingInstall: "[PathResolver] Compiler not found, starting dotnet restore...";
|
|
31
|
-
readonly restoringPackage:
|
|
31
|
+
readonly restoringPackage: '[PathResolver] Restoring NuGet package "{packageName}" v{version} for platform "{platform}" via dotnet restore...';
|
|
32
32
|
readonly runningDotnetRestore: "[PathResolver] Running dotnet restore...";
|
|
33
33
|
readonly restoreCompleted: "[PathResolver] dotnet restore completed";
|
|
34
34
|
readonly installCompleted: "[PathResolver] Compiler restored successfully";
|
package/dist/index.js
CHANGED
|
@@ -656,6 +656,30 @@ import {
|
|
|
656
656
|
translate as translate6
|
|
657
657
|
} from "@uipath/solutionpackager-tool-core";
|
|
658
658
|
|
|
659
|
+
// src/workflow-compiler-config.ts
|
|
660
|
+
var DEFAULT_WORKFLOW_COMPILER_VERSION = "26.0.198-alpha.24031";
|
|
661
|
+
var DEFAULT_DOTNET_PATH = "dotnet";
|
|
662
|
+
var workflowCompilerConfig = {
|
|
663
|
+
workflowCompilerPath: undefined,
|
|
664
|
+
workflowCompilerVersion: DEFAULT_WORKFLOW_COMPILER_VERSION,
|
|
665
|
+
dotnetPath: DEFAULT_DOTNET_PATH,
|
|
666
|
+
dotnetEnv: undefined
|
|
667
|
+
};
|
|
668
|
+
function setupWorkflowCompiler(options) {
|
|
669
|
+
if (options.compilerPath !== undefined) {
|
|
670
|
+
workflowCompilerConfig.workflowCompilerPath = options.compilerPath;
|
|
671
|
+
}
|
|
672
|
+
if (options.version !== undefined) {
|
|
673
|
+
workflowCompilerConfig.workflowCompilerVersion = options.version;
|
|
674
|
+
}
|
|
675
|
+
if (options.dotnetPath !== undefined) {
|
|
676
|
+
workflowCompilerConfig.dotnetPath = options.dotnetPath;
|
|
677
|
+
}
|
|
678
|
+
if (options.dotnetEnv !== undefined) {
|
|
679
|
+
workflowCompilerConfig.dotnetEnv = options.dotnetEnv;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
659
683
|
// ../packager-orchestrator-client/dist/index.js
|
|
660
684
|
import { I18nManager as I18nManager2 } from "@uipath/solutionpackager-tool-core";
|
|
661
685
|
import {
|
|
@@ -765,7 +789,7 @@ function addSdkUserAgentHeader(headers, userAgent) {
|
|
|
765
789
|
}
|
|
766
790
|
var package_default = {
|
|
767
791
|
name: "@uipath/packager-orchestrator-client",
|
|
768
|
-
version: "1.
|
|
792
|
+
version: "1.200.0",
|
|
769
793
|
description: "UiPath packager client for Orchestrator package-feed interaction (feed discovery + NuGet source composition)",
|
|
770
794
|
type: "module",
|
|
771
795
|
private: true,
|
|
@@ -804,7 +828,7 @@ var package_default = {
|
|
|
804
828
|
"@uipath/common": "workspace:*",
|
|
805
829
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
806
830
|
"@vitest/coverage-v8": "^4.1.6",
|
|
807
|
-
typescript: "^
|
|
831
|
+
typescript: "^7.0.2",
|
|
808
832
|
vitest: "^4.1.6"
|
|
809
833
|
}
|
|
810
834
|
};
|
|
@@ -960,29 +984,6 @@ import {
|
|
|
960
984
|
translate as translate5
|
|
961
985
|
} from "@uipath/solutionpackager-tool-core";
|
|
962
986
|
|
|
963
|
-
// src/workflow-compiler-config.ts
|
|
964
|
-
var DEFAULT_WORKFLOW_COMPILER_VERSION = "26.0.198-alpha.24031";
|
|
965
|
-
var workflowCompilerConfig = {
|
|
966
|
-
workflowCompilerPath: undefined,
|
|
967
|
-
workflowCompilerVersion: DEFAULT_WORKFLOW_COMPILER_VERSION,
|
|
968
|
-
dotnetPath: "dotnet",
|
|
969
|
-
dotnetEnv: undefined
|
|
970
|
-
};
|
|
971
|
-
function setupWorkflowCompiler(options) {
|
|
972
|
-
if (options.compilerPath !== undefined) {
|
|
973
|
-
workflowCompilerConfig.workflowCompilerPath = options.compilerPath;
|
|
974
|
-
}
|
|
975
|
-
if (options.version !== undefined) {
|
|
976
|
-
workflowCompilerConfig.workflowCompilerVersion = options.version;
|
|
977
|
-
}
|
|
978
|
-
if (options.dotnetPath !== undefined) {
|
|
979
|
-
workflowCompilerConfig.dotnetPath = options.dotnetPath;
|
|
980
|
-
}
|
|
981
|
-
if (options.dotnetEnv !== undefined) {
|
|
982
|
-
workflowCompilerConfig.dotnetEnv = options.dotnetEnv;
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
987
|
// src/workflow-compiler-path-resolver.ts
|
|
987
988
|
import { execFileSync } from "node:child_process";
|
|
988
989
|
import { homedir, platform } from "node:os";
|
|
@@ -991,7 +992,7 @@ import {
|
|
|
991
992
|
TemporaryStorageService as TemporaryStorageService2,
|
|
992
993
|
translate as translate3
|
|
993
994
|
} from "@uipath/solutionpackager-tool-core";
|
|
994
|
-
var NUGET_FEED_URL = "https://
|
|
995
|
+
var NUGET_FEED_URL = "https://pkgs.uipath.com/internal/index.json";
|
|
995
996
|
var WORKFLOW_COMPILER_DLL_NAME = "UiPath.WorkflowCompiler.dll";
|
|
996
997
|
var PLATFORM_PACKAGE_IDS = {
|
|
997
998
|
win32: "UiPath.WorkflowCompiler.Windows",
|
|
@@ -1371,6 +1372,18 @@ function getAdditionalResultDetails(result) {
|
|
|
1371
1372
|
}
|
|
1372
1373
|
|
|
1373
1374
|
// src/workflow-compiler-tool.ts
|
|
1375
|
+
var NO_CLEANUP_SOURCE_FILES_MESSAGE = "no workflow xamls or coded source files";
|
|
1376
|
+
var CLEANUP_SOURCE_FILE_EXTENSIONS = [".xaml", ".cs", ".vb"];
|
|
1377
|
+
var CLEANUP_SOURCE_SCAN_SKIP_DIRS = new Set([
|
|
1378
|
+
".git",
|
|
1379
|
+
".local",
|
|
1380
|
+
".project",
|
|
1381
|
+
"bin",
|
|
1382
|
+
"dist",
|
|
1383
|
+
"node_modules",
|
|
1384
|
+
"obj"
|
|
1385
|
+
]);
|
|
1386
|
+
|
|
1374
1387
|
class WorkflowCompilerTool extends ProjectTool {
|
|
1375
1388
|
context;
|
|
1376
1389
|
executor;
|
|
@@ -1574,9 +1587,52 @@ class WorkflowCompilerTool extends ProjectTool {
|
|
|
1574
1587
|
args.push(`--nuget-config`, paths.userNugetConfigPath);
|
|
1575
1588
|
}
|
|
1576
1589
|
const result = await this.executor.executeAsync("remove-unused-dependencies", args, cancellationToken);
|
|
1590
|
+
if (await this.shouldRetryCleanupNoSourceFalseNegativeAsync(result, options.projectPath)) {
|
|
1591
|
+
this.logger.warn("[WorkflowCompiler] remove-unused-dependencies reported no workflow/source files even though the project contains source files; retrying once.");
|
|
1592
|
+
const retryResult = await this.executor.executeAsync("remove-unused-dependencies", args, cancellationToken);
|
|
1593
|
+
return this.toProjectCleanupResult(retryResult);
|
|
1594
|
+
}
|
|
1577
1595
|
return this.toProjectCleanupResult(result);
|
|
1578
1596
|
});
|
|
1579
1597
|
}
|
|
1598
|
+
async shouldRetryCleanupNoSourceFalseNegativeAsync(result, projectPath) {
|
|
1599
|
+
if (result.isSuccess) {
|
|
1600
|
+
return false;
|
|
1601
|
+
}
|
|
1602
|
+
const message = result.message?.toLowerCase();
|
|
1603
|
+
if (!message?.includes(NO_CLEANUP_SOURCE_FILES_MESSAGE)) {
|
|
1604
|
+
return false;
|
|
1605
|
+
}
|
|
1606
|
+
return await this.hasCleanupSourceFilesAsync(projectPath);
|
|
1607
|
+
}
|
|
1608
|
+
async hasCleanupSourceFilesAsync(projectPath) {
|
|
1609
|
+
let entries;
|
|
1610
|
+
try {
|
|
1611
|
+
entries = await this.fileSystem.readdir(projectPath);
|
|
1612
|
+
} catch {
|
|
1613
|
+
return false;
|
|
1614
|
+
}
|
|
1615
|
+
for (const entry of entries) {
|
|
1616
|
+
const lowerEntry = entry.toLowerCase();
|
|
1617
|
+
const fullPath = this.fileSystem.path.join(projectPath, entry);
|
|
1618
|
+
let stats;
|
|
1619
|
+
try {
|
|
1620
|
+
stats = await this.fileSystem.stat(fullPath);
|
|
1621
|
+
} catch {
|
|
1622
|
+
continue;
|
|
1623
|
+
}
|
|
1624
|
+
if (!stats) {
|
|
1625
|
+
continue;
|
|
1626
|
+
}
|
|
1627
|
+
if (stats.isFile() && CLEANUP_SOURCE_FILE_EXTENSIONS.some((extension) => lowerEntry.endsWith(extension))) {
|
|
1628
|
+
return true;
|
|
1629
|
+
}
|
|
1630
|
+
if (stats.isDirectory() && !CLEANUP_SOURCE_SCAN_SKIP_DIRS.has(lowerEntry) && await this.hasCleanupSourceFilesAsync(fullPath)) {
|
|
1631
|
+
return true;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1580
1636
|
toProjectCleanupResult(result) {
|
|
1581
1637
|
const raw = result.details?.removeUnusedDependencies;
|
|
1582
1638
|
if (!raw) {
|
|
@@ -1637,11 +1693,14 @@ class WorkflowCompilerToolFactory {
|
|
|
1637
1693
|
ProjectTypes.WebApp
|
|
1638
1694
|
];
|
|
1639
1695
|
async createAsync(logger, fileSystem, context) {
|
|
1640
|
-
if (!this.isDotnetAvailable()) {
|
|
1696
|
+
if (!this.isPinnedByCaller() && !this.isDotnetAvailable()) {
|
|
1641
1697
|
throw new Error(translate6.t("toolWorkflowcompiler.errors.dotnetNotAvailable"));
|
|
1642
1698
|
}
|
|
1643
1699
|
return new WorkflowCompilerTool(fileSystem, logger, context);
|
|
1644
1700
|
}
|
|
1701
|
+
isPinnedByCaller() {
|
|
1702
|
+
return workflowCompilerConfig.workflowCompilerPath !== undefined && workflowCompilerConfig.dotnetPath !== DEFAULT_DOTNET_PATH;
|
|
1703
|
+
}
|
|
1645
1704
|
isDotnetAvailable() {
|
|
1646
1705
|
if (WorkflowCompilerToolFactory.cachedDotnetAvailable !== undefined) {
|
|
1647
1706
|
return WorkflowCompilerToolFactory.cachedDotnetAvailable;
|
|
@@ -1662,4 +1721,4 @@ export {
|
|
|
1662
1721
|
WorkflowCompilerToolFactory
|
|
1663
1722
|
};
|
|
1664
1723
|
|
|
1665
|
-
//# debugId=
|
|
1724
|
+
//# debugId=98DEE79ADEE701B964756E2164756E21
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const DEFAULT_WORKFLOW_COMPILER_VERSION = "26.0.198-alpha.24031";
|
|
2
|
+
/** The dotnet host used when no consumer pins one: whatever `dotnet` PATH resolves to. */
|
|
3
|
+
export declare const DEFAULT_DOTNET_PATH = "dotnet";
|
|
2
4
|
export declare const workflowCompilerConfig: {
|
|
3
5
|
workflowCompilerPath: string | undefined;
|
|
4
6
|
workflowCompilerVersion: string;
|
|
@@ -12,5 +12,17 @@ export declare class WorkflowCompilerToolFactory implements IProjectToolFactory
|
|
|
12
12
|
private static cachedDotnetAvailable;
|
|
13
13
|
readonly supportedTypes: readonly ProjectType[];
|
|
14
14
|
createAsync(logger: IToolLogger, fileSystem: IFileSystem, context?: ProjectOperationContext): Promise<ProjectTool>;
|
|
15
|
+
/**
|
|
16
|
+
* True when the caller has supplied both the compiler and the dotnet host to
|
|
17
|
+
* run it with — i.e. it resolved its own .NET and neither the NuGet-restore
|
|
18
|
+
* fallback nor a machine-wide install is involved.
|
|
19
|
+
*
|
|
20
|
+
* The preflight below asks PATH for an SDK. A pinned host is typically a
|
|
21
|
+
* runtime-only bundle (Studio/Robot ship the runtime, never the SDK), which
|
|
22
|
+
* cannot answer `dotnet --version` at all — that is an SDK verb. Probing it
|
|
23
|
+
* can therefore only reject a configuration that works, so a caller that has
|
|
24
|
+
* pinned both is trusted and the tool is created unconditionally.
|
|
25
|
+
*/
|
|
26
|
+
private isPinnedByCaller;
|
|
15
27
|
private isDotnetAvailable;
|
|
16
28
|
}
|
|
@@ -13,6 +13,8 @@ export declare class WorkflowCompilerTool extends ProjectTool {
|
|
|
13
13
|
buildAsync(options: IProjectBuildOptions, cancellationToken?: AbortSignal): Promise<ToolResult>;
|
|
14
14
|
packAsync(options: IProjectPackOptions, cancellationToken?: AbortSignal): Promise<ToolResult>;
|
|
15
15
|
cleanupAsync(options: IProjectCleanupOptions, cancellationToken?: AbortSignal): Promise<ToolResult>;
|
|
16
|
+
private shouldRetryCleanupNoSourceFalseNegativeAsync;
|
|
17
|
+
private hasCleanupSourceFilesAsync;
|
|
16
18
|
/**
|
|
17
19
|
* Convert the WorkflowCompiler's raw `remove-unused-dependencies` payload
|
|
18
20
|
* into the generic {@link ProjectCleanupInfo} the cleanup pipeline expects,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/packager-tool-workflowcompiler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.200.0-preview.109",
|
|
4
4
|
"description": "UiPath Workflow Compiler tool implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@uipath/solutionpackager-tool-core": "1.
|
|
28
|
+
"@uipath/solutionpackager-tool-core": "1.200.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "fcc01cdae81bbd0c25d3d4fc287537a9d19d99f4"
|
|
32
32
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export const DEFAULT_WORKFLOW_COMPILER_VERSION = "26.0.198-alpha.24031";
|
|
2
2
|
|
|
3
|
+
/** The dotnet host used when no consumer pins one: whatever `dotnet` PATH resolves to. */
|
|
4
|
+
export const DEFAULT_DOTNET_PATH = "dotnet";
|
|
5
|
+
|
|
3
6
|
export const workflowCompilerConfig = {
|
|
4
7
|
workflowCompilerPath: undefined as string | undefined,
|
|
5
8
|
workflowCompilerVersion: DEFAULT_WORKFLOW_COMPILER_VERSION as string,
|
|
6
9
|
// The dotnet host used to launch `UiPath.WorkflowCompiler.dll`. Defaults to `dotnet` on PATH.
|
|
7
10
|
// Consumers that ship a bundled runtime (e.g. rpa-tool resolving Robot/Studio's .NET) point this
|
|
8
11
|
// at the bundled muxer so the compiler runs under that runtime instead of a machine-wide install.
|
|
9
|
-
dotnetPath:
|
|
12
|
+
dotnetPath: DEFAULT_DOTNET_PATH as string,
|
|
10
13
|
// Extra environment variables for the compiler process (e.g. DOTNET_ROOT / DOTNET_MULTILEVEL_LOOKUP).
|
|
11
14
|
// Merged over the inherited process env. Undefined means inherit the parent env unchanged.
|
|
12
15
|
dotnetEnv: undefined as Record<string, string> | undefined,
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
} from "@uipath/solutionpackager-tool-core";
|
|
12
12
|
import { workflowCompilerConfig } from "./workflow-compiler-config.js";
|
|
13
13
|
|
|
14
|
-
const NUGET_FEED_URL =
|
|
15
|
-
"https://uipath.pkgs.visualstudio.com/Public.Feeds/_packaging/UiPath-Internal/nuget/v3/index.json";
|
|
14
|
+
const NUGET_FEED_URL = "https://pkgs.uipath.com/internal/index.json";
|
|
16
15
|
|
|
17
16
|
const WORKFLOW_COMPILER_DLL_NAME = "UiPath.WorkflowCompiler.dll";
|
|
18
17
|
|
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
ProjectTypes,
|
|
10
10
|
translate,
|
|
11
11
|
} from "@uipath/solutionpackager-tool-core";
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_DOTNET_PATH,
|
|
14
|
+
workflowCompilerConfig,
|
|
15
|
+
} from "./workflow-compiler-config.js";
|
|
12
16
|
import { WorkflowCompilerTool } from "./workflow-compiler-tool.js";
|
|
13
17
|
|
|
14
18
|
/**
|
|
@@ -35,7 +39,7 @@ export class WorkflowCompilerToolFactory implements IProjectToolFactory {
|
|
|
35
39
|
fileSystem: IFileSystem,
|
|
36
40
|
context?: ProjectOperationContext,
|
|
37
41
|
): Promise<ProjectTool> {
|
|
38
|
-
if (!this.isDotnetAvailable()) {
|
|
42
|
+
if (!this.isPinnedByCaller() && !this.isDotnetAvailable()) {
|
|
39
43
|
throw new Error(
|
|
40
44
|
translate.t("toolWorkflowcompiler.errors.dotnetNotAvailable"),
|
|
41
45
|
);
|
|
@@ -43,6 +47,24 @@ export class WorkflowCompilerToolFactory implements IProjectToolFactory {
|
|
|
43
47
|
return new WorkflowCompilerTool(fileSystem, logger, context);
|
|
44
48
|
}
|
|
45
49
|
|
|
50
|
+
/**
|
|
51
|
+
* True when the caller has supplied both the compiler and the dotnet host to
|
|
52
|
+
* run it with — i.e. it resolved its own .NET and neither the NuGet-restore
|
|
53
|
+
* fallback nor a machine-wide install is involved.
|
|
54
|
+
*
|
|
55
|
+
* The preflight below asks PATH for an SDK. A pinned host is typically a
|
|
56
|
+
* runtime-only bundle (Studio/Robot ship the runtime, never the SDK), which
|
|
57
|
+
* cannot answer `dotnet --version` at all — that is an SDK verb. Probing it
|
|
58
|
+
* can therefore only reject a configuration that works, so a caller that has
|
|
59
|
+
* pinned both is trusted and the tool is created unconditionally.
|
|
60
|
+
*/
|
|
61
|
+
private isPinnedByCaller(): boolean {
|
|
62
|
+
return (
|
|
63
|
+
workflowCompilerConfig.workflowCompilerPath !== undefined &&
|
|
64
|
+
workflowCompilerConfig.dotnetPath !== DEFAULT_DOTNET_PATH
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
46
68
|
private isDotnetAvailable(): boolean {
|
|
47
69
|
if (WorkflowCompilerToolFactory.cachedDotnetAvailable !== undefined) {
|
|
48
70
|
return WorkflowCompilerToolFactory.cachedDotnetAvailable;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OrchestratorFeedComposer } from "@uipath/packager-orchestrator-client";
|
|
2
2
|
import {
|
|
3
|
+
type FileSystemStats,
|
|
3
4
|
type IFileSystem,
|
|
4
5
|
type IProjectBuildOptions,
|
|
5
6
|
type IProjectCleanupOptions,
|
|
@@ -25,6 +26,19 @@ import { WorkflowCompilerExecutor } from "./workflow-compiler-executor.js";
|
|
|
25
26
|
*/
|
|
26
27
|
type RawRemoveUnusedDependenciesResult = WorkflowCompilerCleanupPayload;
|
|
27
28
|
|
|
29
|
+
const NO_CLEANUP_SOURCE_FILES_MESSAGE =
|
|
30
|
+
"no workflow xamls or coded source files";
|
|
31
|
+
const CLEANUP_SOURCE_FILE_EXTENSIONS = [".xaml", ".cs", ".vb"];
|
|
32
|
+
const CLEANUP_SOURCE_SCAN_SKIP_DIRS = new Set([
|
|
33
|
+
".git",
|
|
34
|
+
".local",
|
|
35
|
+
".project",
|
|
36
|
+
"bin",
|
|
37
|
+
"dist",
|
|
38
|
+
"node_modules",
|
|
39
|
+
"obj",
|
|
40
|
+
]);
|
|
41
|
+
|
|
28
42
|
/**
|
|
29
43
|
* The two NuGet-source channels the WorkflowCompiler accepts, kept apart on
|
|
30
44
|
* purpose:
|
|
@@ -325,10 +339,86 @@ export class WorkflowCompilerTool extends ProjectTool {
|
|
|
325
339
|
args,
|
|
326
340
|
cancellationToken,
|
|
327
341
|
);
|
|
342
|
+
if (
|
|
343
|
+
await this.shouldRetryCleanupNoSourceFalseNegativeAsync(
|
|
344
|
+
result,
|
|
345
|
+
options.projectPath,
|
|
346
|
+
)
|
|
347
|
+
) {
|
|
348
|
+
this.logger.warn(
|
|
349
|
+
"[WorkflowCompiler] remove-unused-dependencies reported no workflow/source files even though the project contains source files; retrying once.",
|
|
350
|
+
);
|
|
351
|
+
const retryResult = await this.executor.executeAsync(
|
|
352
|
+
"remove-unused-dependencies",
|
|
353
|
+
args,
|
|
354
|
+
cancellationToken,
|
|
355
|
+
);
|
|
356
|
+
return this.toProjectCleanupResult(retryResult);
|
|
357
|
+
}
|
|
328
358
|
return this.toProjectCleanupResult(result);
|
|
329
359
|
});
|
|
330
360
|
}
|
|
331
361
|
|
|
362
|
+
private async shouldRetryCleanupNoSourceFalseNegativeAsync(
|
|
363
|
+
result: ToolResult,
|
|
364
|
+
projectPath: string,
|
|
365
|
+
): Promise<boolean> {
|
|
366
|
+
if (result.isSuccess) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const message = result.message?.toLowerCase();
|
|
371
|
+
if (!message?.includes(NO_CLEANUP_SOURCE_FILES_MESSAGE)) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
return await this.hasCleanupSourceFilesAsync(projectPath);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
private async hasCleanupSourceFilesAsync(
|
|
379
|
+
projectPath: string,
|
|
380
|
+
): Promise<boolean> {
|
|
381
|
+
let entries: string[];
|
|
382
|
+
try {
|
|
383
|
+
entries = await this.fileSystem.readdir(projectPath);
|
|
384
|
+
} catch {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
for (const entry of entries) {
|
|
389
|
+
const lowerEntry = entry.toLowerCase();
|
|
390
|
+
const fullPath = this.fileSystem.path.join(projectPath, entry);
|
|
391
|
+
let stats: FileSystemStats | null;
|
|
392
|
+
try {
|
|
393
|
+
stats = await this.fileSystem.stat(fullPath);
|
|
394
|
+
} catch {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (!stats) {
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (
|
|
402
|
+
stats.isFile() &&
|
|
403
|
+
CLEANUP_SOURCE_FILE_EXTENSIONS.some((extension) =>
|
|
404
|
+
lowerEntry.endsWith(extension),
|
|
405
|
+
)
|
|
406
|
+
) {
|
|
407
|
+
return true;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (
|
|
411
|
+
stats.isDirectory() &&
|
|
412
|
+
!CLEANUP_SOURCE_SCAN_SKIP_DIRS.has(lowerEntry) &&
|
|
413
|
+
(await this.hasCleanupSourceFilesAsync(fullPath))
|
|
414
|
+
) {
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
|
|
332
422
|
/**
|
|
333
423
|
* Convert the WorkflowCompiler's raw `remove-unused-dependencies` payload
|
|
334
424
|
* into the generic {@link ProjectCleanupInfo} the cleanup pipeline expects,
|