@uipath/packager-tool-webapp 1.206.0-preview.306 → 1.207.0-preview.307

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.
@@ -0,0 +1,21 @@
1
+ import { type ProjectIdentityReader } from "@uipath/solutionpackager-tool-core";
2
+ /**
3
+ * The identity of a coded app project, for the host's project telemetry.
4
+ *
5
+ * The project's GUID lives in `webAppManifest.json` as `projectId`:
6
+ * `ensureWebAppProjectId` mints and persists it on the first pack and writes
7
+ * it into the packed `operate.json`, so the manifest id is the id of the
8
+ * package `publish` sends and `deploy` deploys. The manifest is read through
9
+ * the same loader the minter uses, and the id is accepted on the minter's
10
+ * terms (a non-empty string), so reader and writer agree by construction: no
11
+ * manifest, or no id yet, is `missing` (a project that was never packed, or
12
+ * a legacy app without a manifest); a manifest that cannot be parsed, or one
13
+ * past the size bound, is `invalid`; a non-GUID id is reported as found and
14
+ * the host marks it `invalid` itself. `projectDirectory` is the resolved
15
+ * project folder, so the host can add the solution keys of an app that is a
16
+ * registered `.uipx` member.
17
+ *
18
+ * Same shape and place as the API workflow packager's reader: the coded app
19
+ * tool's command resolver calls it, and the solution member observer can.
20
+ */
21
+ export declare const readProjectIdentity: ProjectIdentityReader;
@@ -0,0 +1,21 @@
1
+ import type { IFileSystem } from "@uipath/solutionpackager-tool-core";
2
+ import type { CodedAppBuildPlan } from "./coded-app-build.js";
3
+ /**
4
+ * Written beside the app's package.json after a build succeeds. It holds the
5
+ * fingerprint of the app's files as that build left them. Git-ignore it in the
6
+ * app: it is local state, not source.
7
+ */
8
+ export declare const BUILD_STAMP_FILE_NAME = ".uipath-build.json";
9
+ /**
10
+ * True when the bundle folder is there and the app's files still match the
11
+ * stamp the last build left. A missing bundle, a missing stamp, or any changed,
12
+ * added or removed file makes the build stale.
13
+ */
14
+ export declare function isBuildCurrentAsync(fileSystem: IFileSystem, plan: CodedAppBuildPlan, bundleFolder: string): Promise<boolean>;
15
+ /**
16
+ * Stamp the app's files as they are now. Call it after the build succeeds,
17
+ * not before: the install writes a `package-lock.json` when there is none, and
18
+ * the build may write other files, so the stamp has to include them or every
19
+ * later pack would see a change and rebuild.
20
+ */
21
+ export declare function writeBuildStampAsync(fileSystem: IFileSystem, plan: CodedAppBuildPlan, bundleFolder: string): Promise<void>;
@@ -0,0 +1,56 @@
1
+ import type { IFileSystem } from "@uipath/solutionpackager-tool-core";
2
+ import { ToolErrorCodes } from "@uipath/solutionpackager-tool-core";
3
+ import type { CommandRunner } from "./command-runner.js";
4
+ /**
5
+ * A coded app cannot be packed as it is: its dependencies could not be
6
+ * installed, its build could not run or did not pass, or there is no build
7
+ * output to pack. It carries the next step and who can fix it: most of these
8
+ * the app's author fixes ({@link ToolErrorCodes.InvalidProject}), but a failed
9
+ * install is often the registry or the network
10
+ * ({@link ToolErrorCodes.DependencyInstallFailed}).
11
+ */
12
+ export declare class CodedAppNotPackableError extends Error {
13
+ readonly instructions: string;
14
+ readonly errorCode: ToolErrorCodes.InvalidProject | ToolErrorCodes.DependencyInstallFailed;
15
+ constructor(message: string, instructions: string, errorCode?: ToolErrorCodes.InvalidProject | ToolErrorCodes.DependencyInstallFailed);
16
+ }
17
+ /**
18
+ * Where the bundle folder's content came from in this pack, which decides
19
+ * what to do when it is missing or unusable: the build ran and left nothing
20
+ * usable, the app has no build to run, or this pack was not going to build it
21
+ * (a host with no command runner, or a folder handed over by the caller).
22
+ */
23
+ export type BundleSource = "built" | "current" | "no-build-script" | "not-building";
24
+ /** The next step for a bundle folder that is missing or holds no app. */
25
+ export declare function bundleProblemInstructions(bundleFolder: string, source: BundleSource): string;
26
+ /** What building one coded app takes, in the folder that holds its package.json. */
27
+ export interface CodedAppBuildPlan {
28
+ folder: string;
29
+ manager: string;
30
+ /** The lockfile the manager was chosen from, if any. */
31
+ lockfile?: string;
32
+ installArgs: readonly string[];
33
+ }
34
+ /**
35
+ * The build a coded app declares, or `null` when there is nothing to build:
36
+ * no package.json between the bundle folder and the project root, or one
37
+ * without a `build` script (an app that commits its bundle).
38
+ *
39
+ * The search starts at the bundle folder's parent because that is where the
40
+ * build writes from: `codedapp init` inside a solution keeps package.json in
41
+ * `source/` and builds to `source/dist`, a standalone app keeps it at the root.
42
+ */
43
+ export declare function planCodedAppBuildAsync(fileSystem: IFileSystem, projectPath: string, bundlePath: string): Promise<CodedAppBuildPlan | null>;
44
+ /**
45
+ * Install the app's dependencies when `node_modules` is missing, then run its
46
+ * `build` script, both with the package manager its lockfile names.
47
+ */
48
+ export declare function runCodedAppBuildAsync(args: {
49
+ fileSystem: IFileSystem;
50
+ runner: CommandRunner;
51
+ plan: CodedAppBuildPlan;
52
+ logger?: {
53
+ progress: (message: string) => void;
54
+ };
55
+ signal?: AbortSignal;
56
+ }): Promise<void>;
@@ -1,13 +1,21 @@
1
1
  import type { IFileSystem } from "@uipath/solutionpackager-tool-core";
2
2
  import type { WebAppManifest } from "../models/webapp-manifest.js";
3
+ import type { CommandRunner } from "./command-runner.js";
3
4
  import type { PackageArgs, VariantStrategy } from "./variant-strategy.js";
4
5
  /**
5
6
  * Coded app strategy for Coded variant
6
- * Supports isCompiled=true (v1) and isCompiled=false (future)
7
+ *
8
+ * `config.isCompiled: true` (the default, and what every scaffold writes) packs
9
+ * the app's build output from `config.bundlePath`. With a {@link CommandRunner},
10
+ * a pack that was not handed a built folder runs the app's own build unless the
11
+ * bundle was built from the app's current sources (see
12
+ * `coded-app-build-stamp.ts`). A CI checkout has no bundle, so it builds.
13
+ * `isCompiled: false` is reserved and still refused.
7
14
  */
8
15
  export declare class CodedAppStrategy implements VariantStrategy {
9
16
  private readonly fileSystem;
10
- constructor(fileSystem: IFileSystem);
17
+ private readonly commandRunner?;
18
+ constructor(fileSystem: IFileSystem, commandRunner?: CommandRunner | undefined);
11
19
  /**
12
20
  * Variant-specific validation: warn if compiled bundle is expected but missing
13
21
  */
@@ -22,6 +30,15 @@ export declare class CodedAppStrategy implements VariantStrategy {
22
30
  };
23
31
  }): Promise<void>;
24
32
  packageAsync(args: PackageArgs): Promise<string>;
33
+ /**
34
+ * Builds the bundle when this pack builds and the app has a build to run,
35
+ * unless the bundle was built from the app's current sources. Returns where
36
+ * the bundle's content came from, which decides the next step when it
37
+ * turns out missing or unusable.
38
+ */
39
+ private prepareBundleAsync;
40
+ /** Refuses a bundle that is missing, not a folder, or holds no entry point. */
41
+ private assertBundlePackableAsync;
25
42
  /**
26
43
  * Prepare metadata files (operate.json, package-descriptor.json, bindings.json, bindings_v2.json, entry-points.json)
27
44
  */
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What a finished command reported.
3
+ *
4
+ * `startError` is set, and `exitCode` is `null`, when the command could not be
5
+ * started at all (most often: the executable is not on `PATH`).
6
+ */
7
+ export interface CommandResult {
8
+ exitCode: number | null;
9
+ /** stdout and stderr, interleaved in the order they arrived. */
10
+ output: string;
11
+ startError?: string;
12
+ }
13
+ /**
14
+ * Runs a command in a folder and waits for it to end.
15
+ *
16
+ * This package builds for the browser as well as for Node, so it cannot spawn
17
+ * processes itself. A Node host passes a runner to `WebAppToolFactory`; a host
18
+ * that passes none packs a coded app's existing bundle without building it.
19
+ */
20
+ export interface CommandRunner {
21
+ runAsync(command: string, args: readonly string[], options: {
22
+ cwd: string;
23
+ signal?: AbortSignal;
24
+ }): Promise<CommandResult>;
25
+ }
@@ -1,5 +1,6 @@
1
1
  import type { IFileSystem } from "@uipath/solutionpackager-tool-core";
2
2
  import type { WebAppManifest } from "../models/webapp-manifest.js";
3
+ import type { CommandRunner } from "./command-runner.js";
3
4
  import type { VariantStrategy } from "./variant-strategy.js";
4
5
  /**
5
6
  * Factory for creating variant-specific packaging strategies
@@ -9,8 +10,9 @@ export declare class VariantStrategyFactory {
9
10
  * Create a strategy instance based on manifest type
10
11
  * @param manifest - WebApp manifest
11
12
  * @param fileSystem - File system instance
13
+ * @param commandRunner - Lets a coded app be built before it is packed
12
14
  * @returns Strategy instance
13
15
  * @throws Error if variant is not supported
14
16
  */
15
- static createStrategy(manifest: WebAppManifest, fileSystem: IFileSystem): VariantStrategy;
17
+ static createStrategy(manifest: WebAppManifest, fileSystem: IFileSystem, commandRunner?: CommandRunner): VariantStrategy;
16
18
  }
@@ -24,6 +24,15 @@ export interface PackageArgs {
24
24
  * NuGet package information
25
25
  */
26
26
  packageInfo: NugetPackageInfo;
27
+ /**
28
+ * Run the app's own build before packaging, when the strategy has a
29
+ * command runner. False when the caller handed over a folder it already
30
+ * built (`uip codedapp pack <dist>`) or asked to pack the existing output
31
+ * (`uip solution pack --skip-build`).
32
+ */
33
+ buildApp?: boolean;
34
+ /** Cancels a build the pack started. */
35
+ signal?: AbortSignal;
27
36
  /**
28
37
  * Logger instance (optional, for strategy-specific logging)
29
38
  */
@@ -1,9 +1,16 @@
1
1
  import { type IFileSystem, type IProjectToolFactory, type IToolLogger, type ProjectType } from "@uipath/solutionpackager-tool-core";
2
+ import type { CommandRunner } from "./strategies/command-runner.js";
2
3
  import { WebAppTool } from "./webapp-tool.js";
3
4
  /**
4
5
  * Factory for creating WebApp project tools
6
+ *
7
+ * A Node host passes a {@link CommandRunner} so packing a coded app builds it
8
+ * first; without one (the browser) the app's existing bundle is packed.
5
9
  */
6
10
  export declare class WebAppToolFactory implements IProjectToolFactory {
11
+ private readonly commandRunner?;
12
+ readProjectIdentityAsync: import("@uipath/solutionpackager-tool-core").ProjectIdentityReader;
7
13
  readonly supportedTypes: readonly ProjectType[];
14
+ constructor(commandRunner?: CommandRunner | undefined);
8
15
  createAsync(logger: IToolLogger, fileSystem: IFileSystem): Promise<WebAppTool>;
9
16
  }
@@ -1,12 +1,14 @@
1
1
  import { type IFileSystem, type IProjectBuildOptions, type IProjectPackOptions, type IProjectRestoreOptions, type IProjectValidateOptions, type IToolLogger, ProjectTool, ToolResult } from "@uipath/solutionpackager-tool-core";
2
+ import type { CommandRunner } from "./strategies/command-runner.js";
2
3
  /**
3
4
  * WebApp project tool implementation
4
5
  * Packages WebApp-type projects into .nupkg artifacts
5
6
  */
6
7
  export declare class WebAppTool extends ProjectTool {
8
+ private readonly commandRunner?;
7
9
  private readonly _temporaryStorage;
8
10
  private _tempBuildFolder;
9
- constructor(fileSystem: IFileSystem, logger: IToolLogger);
11
+ constructor(fileSystem: IFileSystem, logger: IToolLogger, commandRunner?: CommandRunner | undefined);
10
12
  restoreAsync(_options: IProjectRestoreOptions, _cancellationToken?: AbortSignal): Promise<ToolResult>;
11
13
  validateAsync(options: IProjectValidateOptions, _cancellationToken?: AbortSignal): Promise<ToolResult>;
12
14
  buildAsync(_options: IProjectBuildOptions, _cancellationToken?: AbortSignal): Promise<ToolResult>;
@@ -16,7 +18,7 @@ export declare class WebAppTool extends ProjectTool {
16
18
  bundlePath: string;
17
19
  mainFile: string;
18
20
  };
19
- }, _cancellationToken?: AbortSignal): Promise<ToolResult>;
21
+ }, cancellationToken?: AbortSignal): Promise<ToolResult>;
20
22
  dispose(): Promise<void>;
21
23
  /**
22
24
  * Common helper that validates manifest file presence, loads manifest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/packager-tool-webapp",
3
- "version": "1.206.0-preview.306",
3
+ "version": "1.207.0-preview.307",
4
4
  "description": "UiPath WebApp tool implementation",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,9 +23,9 @@
23
23
  "author": "UiPath",
24
24
  "license": "SEE LICENSE IN LICENSE.txt",
25
25
  "peerDependencies": {
26
- "@uipath/common": "1.206.0",
27
- "@uipath/solutionpackager-tool-core": "1.206.0",
26
+ "@uipath/common": "1.207.0",
27
+ "@uipath/solutionpackager-tool-core": "1.207.0",
28
28
  "zod": "^4.3.6"
29
29
  },
30
- "gitHead": "0b8843ae9b6d2f69a0203f96ab91e5d55e416383"
30
+ "gitHead": "a625ed8ac421089170db3cb8b95c497f3c7b0d62"
31
31
  }