@salesforce/ui-bundle-template-cli 1.117.2
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/LICENSE.txt +82 -0
- package/README.md +1613 -0
- package/dist/commands/apply-patches.d.ts +23 -0
- package/dist/commands/apply-patches.d.ts.map +1 -0
- package/dist/commands/apply-patches.js +804 -0
- package/dist/commands/apply-patches.js.map +1 -0
- package/dist/commands/new-app-feature.d.ts +7 -0
- package/dist/commands/new-app-feature.d.ts.map +1 -0
- package/dist/commands/new-app-feature.js +215 -0
- package/dist/commands/new-app-feature.js.map +1 -0
- package/dist/commands/new-app.d.ts +6 -0
- package/dist/commands/new-app.d.ts.map +1 -0
- package/dist/commands/new-app.js +7 -0
- package/dist/commands/new-app.js.map +1 -0
- package/dist/commands/watch-patches.d.ts +4 -0
- package/dist/commands/watch-patches.d.ts.map +1 -0
- package/dist/commands/watch-patches.js +134 -0
- package/dist/commands/watch-patches.js.map +1 -0
- package/dist/core/dependency-resolver.d.ts +40 -0
- package/dist/core/dependency-resolver.d.ts.map +1 -0
- package/dist/core/dependency-resolver.js +126 -0
- package/dist/core/dependency-resolver.js.map +1 -0
- package/dist/core/file-operations.d.ts +55 -0
- package/dist/core/file-operations.d.ts.map +1 -0
- package/dist/core/file-operations.js +350 -0
- package/dist/core/file-operations.js.map +1 -0
- package/dist/core/package-json-merger.d.ts +19 -0
- package/dist/core/package-json-merger.d.ts.map +1 -0
- package/dist/core/package-json-merger.js +104 -0
- package/dist/core/package-json-merger.js.map +1 -0
- package/dist/core/patch-loader.d.ts +18 -0
- package/dist/core/patch-loader.d.ts.map +1 -0
- package/dist/core/patch-loader.js +115 -0
- package/dist/core/patch-loader.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/nx-plugin/executors/apply-patches/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/apply-patches/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/apply-patches/executor.js +77 -0
- package/dist/nx-plugin/executors/apply-patches/executor.js.map +1 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.js +88 -0
- package/dist/nx-plugin/executors/build-dist-app/executor.js.map +1 -0
- package/dist/nx-plugin/executors/dev-server/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/dev-server/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/dev-server/executor.js +59 -0
- package/dist/nx-plugin/executors/dev-server/executor.js.map +1 -0
- package/dist/nx-plugin/executors/utils.d.ts +9 -0
- package/dist/nx-plugin/executors/utils.d.ts.map +1 -0
- package/dist/nx-plugin/executors/utils.js +25 -0
- package/dist/nx-plugin/executors/utils.js.map +1 -0
- package/dist/nx-plugin/executors/watch-patches/executor.d.ts +20 -0
- package/dist/nx-plugin/executors/watch-patches/executor.d.ts.map +1 -0
- package/dist/nx-plugin/executors/watch-patches/executor.js +71 -0
- package/dist/nx-plugin/executors/watch-patches/executor.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/debounce.d.ts +9 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +20 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/import-merger.d.ts +17 -0
- package/dist/utils/import-merger.d.ts.map +1 -0
- package/dist/utils/import-merger.js +244 -0
- package/dist/utils/import-merger.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +23 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-mappings.d.ts +94 -0
- package/dist/utils/path-mappings.d.ts.map +1 -0
- package/dist/utils/path-mappings.js +139 -0
- package/dist/utils/path-mappings.js.map +1 -0
- package/dist/utils/paths.d.ts +61 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +182 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/route-merger.d.ts +107 -0
- package/dist/utils/route-merger.d.ts.map +1 -0
- package/dist/utils/route-merger.js +358 -0
- package/dist/utils/route-merger.js.map +1 -0
- package/dist/utils/validation.d.ts +35 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +137 -0
- package/dist/utils/validation.js.map +1 -0
- package/executors.json +24 -0
- package/package.json +48 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { spawn } from "child_process";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
import { logger } from "@nx/devkit";
|
|
9
|
+
import { createProjectPaths } from "../utils";
|
|
10
|
+
/**
|
|
11
|
+
* Nx executor for starting the dev server
|
|
12
|
+
*
|
|
13
|
+
* This executor starts a Vite dev server for the UI Bundle.
|
|
14
|
+
* It runs npm install first, then starts the dev server asynchronously.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Executor options
|
|
17
|
+
* @param context - Nx executor context
|
|
18
|
+
* @returns Async generator yielding executor results
|
|
19
|
+
*/
|
|
20
|
+
export default async function* runExecutor(options, context) {
|
|
21
|
+
try {
|
|
22
|
+
const projectPaths = createProjectPaths(context);
|
|
23
|
+
if (!projectPaths) {
|
|
24
|
+
yield { success: false };
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// Build absolute path to the UI bundle
|
|
28
|
+
const targetPath = join(context.root, projectPaths.uiBundle);
|
|
29
|
+
logger.info(`Starting application dev server in ${targetPath}...`);
|
|
30
|
+
// Start dev server asynchronously (long-running)
|
|
31
|
+
logger.info("Running npm run dev...");
|
|
32
|
+
const devServer = spawn("npm", ["run", "dev"], {
|
|
33
|
+
cwd: targetPath,
|
|
34
|
+
stdio: "inherit",
|
|
35
|
+
shell: true,
|
|
36
|
+
env: process.env,
|
|
37
|
+
});
|
|
38
|
+
yield { success: true };
|
|
39
|
+
// Keep running until process exits
|
|
40
|
+
await new Promise((resolve, reject) => {
|
|
41
|
+
devServer.on("exit", (code) => {
|
|
42
|
+
if (code === 0) {
|
|
43
|
+
resolve();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
reject(new Error(`Dev server exited with code ${code}`));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
devServer.on("error", reject);
|
|
50
|
+
});
|
|
51
|
+
yield { success: true };
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
55
|
+
logger.error(`Failed to start dev server: ${errorMessage}`);
|
|
56
|
+
yield { success: false };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/dev-server/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAwB,MAAM,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAS9C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,WAAW,CACzC,OAAiC,EACjC,OAAwB;IAExB,IAAI,CAAC;QACJ,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,MAAM,EAAE,OAAO,EAAE,KAA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AAE,CAAC,CAAC;QAC5D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/nx-plugin/executors/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAE1D,UAAU,KAAK;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,KAAK,CAmBzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { basename, join } from "path";
|
|
7
|
+
import { logger } from "@nx/devkit";
|
|
8
|
+
export function createProjectPaths(context) {
|
|
9
|
+
// Validate that we have a project name
|
|
10
|
+
if (!context.projectName) {
|
|
11
|
+
logger.error("Project name is required");
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
// Get project configuration
|
|
15
|
+
const project = context.projectGraph?.nodes[context.projectName];
|
|
16
|
+
if (!project) {
|
|
17
|
+
logger.error(`Project ${context.projectName} not found in project graph`);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const root = project.data.root;
|
|
21
|
+
const dist = join(root, "dist");
|
|
22
|
+
const uiBundle = join(dist, "force-app/main/default/uiBundles", basename(root));
|
|
23
|
+
return { root, dist, uiBundle };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nx-plugin/executors/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAwB,MAAM,EAAE,MAAM,YAAY,CAAC;AAQ1D,MAAM,UAAU,kBAAkB,CAAC,OAAwB;IAC1D,uCAAuC;IACvC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,4BAA4B;IAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACjE,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,WAAW,OAAO,CAAC,WAAW,6BAA6B,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,kCAAkC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import type { WatchPatchesExecutorOptions } from "./schema";
|
|
3
|
+
/**
|
|
4
|
+
* Result of the executor
|
|
5
|
+
*/
|
|
6
|
+
export interface WatchPatchesExecutorResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Nx executor for watching template patches
|
|
11
|
+
*
|
|
12
|
+
* This executor wraps the apply-patches CLI command in watch mode and automatically
|
|
13
|
+
* determines paths based on the Nx project configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Executor options
|
|
16
|
+
* @param context - Nx executor context
|
|
17
|
+
* @returns Async generator yielding executor results
|
|
18
|
+
*/
|
|
19
|
+
export default function runExecutor(options: WatchPatchesExecutorOptions, context: ExecutorContext): AsyncGenerator<WatchPatchesExecutorResult>;
|
|
20
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/watch-patches/executor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAA+B,WAAW,CACzC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,eAAe,GACtB,cAAc,CAAC,0BAA0B,CAAC,CA4D5C"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { spawn } from "child_process";
|
|
7
|
+
import { logger } from "@nx/devkit";
|
|
8
|
+
import { createProjectPaths } from "../utils";
|
|
9
|
+
/**
|
|
10
|
+
* Nx executor for watching template patches
|
|
11
|
+
*
|
|
12
|
+
* This executor wraps the apply-patches CLI command in watch mode and automatically
|
|
13
|
+
* determines paths based on the Nx project configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Executor options
|
|
16
|
+
* @param context - Nx executor context
|
|
17
|
+
* @returns Async generator yielding executor results
|
|
18
|
+
*/
|
|
19
|
+
export default async function* runExecutor(options, context) {
|
|
20
|
+
try {
|
|
21
|
+
const projectPaths = createProjectPaths(context);
|
|
22
|
+
if (!projectPaths) {
|
|
23
|
+
yield { success: false };
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// Get workspace root (absolute path)
|
|
27
|
+
const workspaceRoot = context.root;
|
|
28
|
+
// Build paths for CLI command
|
|
29
|
+
const featurePath = projectPaths.root;
|
|
30
|
+
const baseAppPath = options.baseAppPath || "packages/template/base-app/base-react-app";
|
|
31
|
+
const outputPath = projectPaths.dist;
|
|
32
|
+
logger.info(`Watching patches for ${context.projectName}...`);
|
|
33
|
+
logger.info(` Feature path: ${featurePath}`);
|
|
34
|
+
logger.info(` Base app: ${baseAppPath}`);
|
|
35
|
+
logger.info(` Output: ${outputPath}`);
|
|
36
|
+
// Execute the CLI command via npx tsx
|
|
37
|
+
const cliPath = "packages/template/patches-cli/src/index.ts";
|
|
38
|
+
/*
|
|
39
|
+
* Just in case watchPatchesCommand has issues like applyPatchesCommand (see `apply` executor)
|
|
40
|
+
*/
|
|
41
|
+
// Build command with arguments
|
|
42
|
+
const command = `npx tsx ${cliPath} watch-patches ${featurePath} ${baseAppPath} ${outputPath}`;
|
|
43
|
+
logger.info(` Executing: ${command}`);
|
|
44
|
+
const watchProcess = spawn(command, {
|
|
45
|
+
cwd: workspaceRoot,
|
|
46
|
+
stdio: "inherit",
|
|
47
|
+
shell: true,
|
|
48
|
+
env: process.env,
|
|
49
|
+
});
|
|
50
|
+
yield { success: true };
|
|
51
|
+
// Keep running until process exits
|
|
52
|
+
await new Promise((resolve, reject) => {
|
|
53
|
+
watchProcess.on("exit", (code) => {
|
|
54
|
+
if (code === 0) {
|
|
55
|
+
resolve();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
reject(new Error(`Watch process exited with code ${code}`));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
watchProcess.on("error", reject);
|
|
62
|
+
});
|
|
63
|
+
yield { success: true };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
67
|
+
logger.error(`Failed to watch patches: ${errorMessage}`);
|
|
68
|
+
yield { success: false };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/watch-patches/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAwB,MAAM,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAS9C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,WAAW,CACzC,OAAoC,EACpC,OAAwB;IAExB,IAAI,CAAC;QACJ,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YACzB,OAAO;QACR,CAAC;QAED,qCAAqC;QACrC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;QAEnC,8BAA8B;QAC9B,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC;QACtC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,2CAA2C,CAAC;QACvF,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC;QAErC,MAAM,CAAC,IAAI,CAAC,wBAAwB,OAAO,CAAC,WAAW,KAAK,CAAC,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,mBAAmB,WAAW,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,eAAe,WAAW,EAAE,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,aAAa,UAAU,EAAE,CA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IAC1B,CAAC;AACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
export interface PackageJsonDependencies {
|
|
7
|
+
dependencies?: Record<string, string>;
|
|
8
|
+
devDependencies?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface PathMapping {
|
|
11
|
+
from: string;
|
|
12
|
+
to: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PathMappings {
|
|
15
|
+
mappings?: PathMapping[];
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface Patch {
|
|
19
|
+
templateDir?: string;
|
|
20
|
+
uiBundleName?: string;
|
|
21
|
+
routeFilePath?: string;
|
|
22
|
+
packageJson?: PackageJsonDependencies;
|
|
23
|
+
dependencies?: string[];
|
|
24
|
+
pathMappings?: PathMappings;
|
|
25
|
+
/** When true, copy site-container metadata from template-site-container and replace parameters with app name */
|
|
26
|
+
siteContainer?: boolean;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gHAAgH;IAChH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
type DebounceableFunction = (...args: any[]) => any;
|
|
7
|
+
export declare function debounce<T extends DebounceableFunction>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,KAAK,oBAAoB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEpD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,oBAAoB,EACtD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACV,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAelC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
export function debounce(func, wait) {
|
|
7
|
+
let timeoutId = null;
|
|
8
|
+
return function debounced(...args) {
|
|
9
|
+
// Clear any existing timeout
|
|
10
|
+
if (timeoutId !== null) {
|
|
11
|
+
clearTimeout(timeoutId);
|
|
12
|
+
}
|
|
13
|
+
// Set a new timeout
|
|
14
|
+
timeoutId = setTimeout(() => {
|
|
15
|
+
func(...args);
|
|
16
|
+
timeoutId = null;
|
|
17
|
+
}, wait);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=debounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,UAAU,QAAQ,CACvB,IAAO,EACP,IAAY;IAEZ,IAAI,SAAS,GAA0B,IAAI,CAAC;IAE5C,OAAO,SAAS,SAAS,CAAC,GAAG,IAAmB;QAC/C,6BAA6B;QAC7B,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACxB,YAAY,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC;QAED,oBAAoB;QACpB,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACd,SAAS,GAAG,IAAI,CAAC;QAClB,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { type SourceFile } from "ts-morph";
|
|
7
|
+
/**
|
|
8
|
+
* Merge imports from feature file into target file
|
|
9
|
+
* Handles:
|
|
10
|
+
* - Deduplicating imports from the same module
|
|
11
|
+
* - Merging named imports from the same module
|
|
12
|
+
* - Preventing duplicate default import names from different modules
|
|
13
|
+
* - Merging different import types from the same module
|
|
14
|
+
* - Removing imports from __delete__ marked files
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeImports(featureFile: SourceFile, targetFile: SourceFile): void;
|
|
17
|
+
//# sourceMappingURL=import-merger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-merger.d.ts","sourceRoot":"","sources":["../../src/utils/import-merger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CA6HlF"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge imports from feature file into target file
|
|
3
|
+
* Handles:
|
|
4
|
+
* - Deduplicating imports from the same module
|
|
5
|
+
* - Merging named imports from the same module
|
|
6
|
+
* - Preventing duplicate default import names from different modules
|
|
7
|
+
* - Merging different import types from the same module
|
|
8
|
+
* - Removing imports from __delete__ marked files
|
|
9
|
+
*/
|
|
10
|
+
export function mergeImports(featureFile, targetFile) {
|
|
11
|
+
const featureImports = featureFile.getImportDeclarations();
|
|
12
|
+
const targetImports = targetFile.getImportDeclarations();
|
|
13
|
+
// Build a map of existing target imports by module specifier
|
|
14
|
+
// This handles multiple imports from the same module in the target
|
|
15
|
+
const targetImportsMap = new Map();
|
|
16
|
+
const duplicateTargetImports = [];
|
|
17
|
+
for (const imp of targetImports) {
|
|
18
|
+
const moduleSpecifier = imp.getModuleSpecifierValue();
|
|
19
|
+
if (!targetImportsMap.has(moduleSpecifier)) {
|
|
20
|
+
targetImportsMap.set(moduleSpecifier, imp);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Found a duplicate import from same module, mark for merging
|
|
24
|
+
duplicateTargetImports.push(imp);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Merge duplicate imports in target first
|
|
28
|
+
for (const duplicateImport of duplicateTargetImports) {
|
|
29
|
+
const moduleSpecifier = duplicateImport.getModuleSpecifierValue();
|
|
30
|
+
const primaryImport = targetImportsMap.get(moduleSpecifier);
|
|
31
|
+
if (primaryImport) {
|
|
32
|
+
mergeImportDeclarations(duplicateImport, primaryImport);
|
|
33
|
+
duplicateImport.remove();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Track all default import names already in target (to prevent conflicts)
|
|
37
|
+
const existingDefaultImportNames = new Set();
|
|
38
|
+
for (const imp of targetFile.getImportDeclarations()) {
|
|
39
|
+
const defaultImport = imp.getDefaultImport();
|
|
40
|
+
if (defaultImport) {
|
|
41
|
+
existingDefaultImportNames.add(defaultImport.getText());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Add/merge imports from feature
|
|
45
|
+
for (const featureImport of featureImports) {
|
|
46
|
+
const moduleSpecifier = featureImport.getModuleSpecifierValue();
|
|
47
|
+
const targetImport = targetImportsMap.get(moduleSpecifier);
|
|
48
|
+
const featureDefaultImport = featureImport.getDefaultImport()?.getText();
|
|
49
|
+
if (!targetImport) {
|
|
50
|
+
// Import from this module doesn't exist in target
|
|
51
|
+
// Check if default import name would conflict
|
|
52
|
+
if (featureDefaultImport && existingDefaultImportNames.has(featureDefaultImport)) {
|
|
53
|
+
// Feature import has same name as existing import from different module
|
|
54
|
+
// Feature should take precedence - find and replace the conflicting import
|
|
55
|
+
const conflictingImport = targetFile
|
|
56
|
+
.getImportDeclarations()
|
|
57
|
+
.find((imp) => imp.getDefaultImport()?.getText() === featureDefaultImport &&
|
|
58
|
+
imp.getModuleSpecifierValue() !== moduleSpecifier);
|
|
59
|
+
if (conflictingImport) {
|
|
60
|
+
// Replace the module specifier of the conflicting import
|
|
61
|
+
conflictingImport.setModuleSpecifier(moduleSpecifier);
|
|
62
|
+
// Merge any named imports from feature into the updated import
|
|
63
|
+
const featureNamedImports = featureImport.getNamedImports();
|
|
64
|
+
if (featureNamedImports.length > 0) {
|
|
65
|
+
const existingNamedImports = new Set(conflictingImport.getNamedImports().map((ni) => ni.getName()));
|
|
66
|
+
for (const namedImport of featureNamedImports) {
|
|
67
|
+
const importName = namedImport.getName();
|
|
68
|
+
if (!existingNamedImports.has(importName)) {
|
|
69
|
+
conflictingImport.addNamedImport({
|
|
70
|
+
name: importName,
|
|
71
|
+
alias: namedImport.getAliasNode()?.getText(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Update the map to point to the updated import
|
|
77
|
+
targetImportsMap.set(moduleSpecifier, conflictingImport);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Add the import
|
|
82
|
+
targetFile.addImportDeclaration({
|
|
83
|
+
moduleSpecifier: moduleSpecifier,
|
|
84
|
+
isTypeOnly: featureImport.isTypeOnly(),
|
|
85
|
+
namedImports: featureImport.getNamedImports().map((ni) => ({
|
|
86
|
+
name: ni.getName(),
|
|
87
|
+
alias: ni.getAliasNode()?.getText(),
|
|
88
|
+
isTypeOnly: ni.isTypeOnly(),
|
|
89
|
+
})),
|
|
90
|
+
defaultImport: featureDefaultImport,
|
|
91
|
+
namespaceImport: featureImport.getNamespaceImport()?.getText(),
|
|
92
|
+
});
|
|
93
|
+
// Track the new default import
|
|
94
|
+
if (featureDefaultImport) {
|
|
95
|
+
existingDefaultImportNames.add(featureDefaultImport);
|
|
96
|
+
}
|
|
97
|
+
// Update map with new import
|
|
98
|
+
const newImports = targetFile.getImportDeclarations();
|
|
99
|
+
const addedImport = newImports[newImports.length - 1];
|
|
100
|
+
targetImportsMap.set(moduleSpecifier, addedImport);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Import from this module exists, merge them
|
|
104
|
+
mergeImportDeclarations(featureImport, targetImport);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Final deduplication pass for named imports
|
|
108
|
+
deduplicateNamedImports(targetFile);
|
|
109
|
+
// Remove imports from __delete__ marked files
|
|
110
|
+
removeDeleteMarkedImports(targetFile);
|
|
111
|
+
// Ensure proper formatting: blank line after imports
|
|
112
|
+
ensureBlankLineAfterImports(targetFile);
|
|
113
|
+
// Don't call organizeImports() as it can be too aggressive and remove imports
|
|
114
|
+
// that are actually needed but appear unused in the isolated file context
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Merge sourceImport into targetImport
|
|
118
|
+
* Combines default imports, named imports, and namespace imports
|
|
119
|
+
* Handles type imports vs regular imports appropriately
|
|
120
|
+
*/
|
|
121
|
+
function mergeImportDeclarations(sourceImport, targetImport) {
|
|
122
|
+
const sourceIsTypeOnly = sourceImport.isTypeOnly();
|
|
123
|
+
const targetIsTypeOnly = targetImport.isTypeOnly();
|
|
124
|
+
// If type-only status differs, we need to add a separate import declaration
|
|
125
|
+
// instead of merging, because you can't mix type and regular imports
|
|
126
|
+
if (sourceIsTypeOnly !== targetIsTypeOnly) {
|
|
127
|
+
// Get the source file and add a new import
|
|
128
|
+
const targetFile = targetImport.getSourceFile();
|
|
129
|
+
const moduleSpecifier = sourceImport.getModuleSpecifierValue();
|
|
130
|
+
// Check if an import with matching type-only status already exists
|
|
131
|
+
const existingMatchingImport = targetFile
|
|
132
|
+
.getImportDeclarations()
|
|
133
|
+
.find((imp) => imp.getModuleSpecifierValue() === moduleSpecifier &&
|
|
134
|
+
imp.isTypeOnly() === sourceIsTypeOnly &&
|
|
135
|
+
imp !== targetImport);
|
|
136
|
+
if (existingMatchingImport) {
|
|
137
|
+
// Merge into the matching import instead
|
|
138
|
+
mergeImportDeclarations(sourceImport, existingMatchingImport);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// Add new import with same type-only status as source
|
|
142
|
+
targetFile.addImportDeclaration({
|
|
143
|
+
moduleSpecifier: moduleSpecifier,
|
|
144
|
+
isTypeOnly: sourceIsTypeOnly,
|
|
145
|
+
namedImports: sourceImport.getNamedImports().map((ni) => ({
|
|
146
|
+
name: ni.getName(),
|
|
147
|
+
alias: ni.getAliasNode()?.getText(),
|
|
148
|
+
isTypeOnly: ni.isTypeOnly(),
|
|
149
|
+
})),
|
|
150
|
+
defaultImport: sourceImport.getDefaultImport()?.getText(),
|
|
151
|
+
namespaceImport: sourceImport.getNamespaceImport()?.getText(),
|
|
152
|
+
});
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
// Same type-only status, proceed with merge
|
|
156
|
+
// Add default import if target doesn't have one and source does
|
|
157
|
+
const sourceDefaultImport = sourceImport.getDefaultImport();
|
|
158
|
+
const targetDefaultImport = targetImport.getDefaultImport();
|
|
159
|
+
if (sourceDefaultImport && !targetDefaultImport) {
|
|
160
|
+
targetImport.setDefaultImport(sourceDefaultImport.getText());
|
|
161
|
+
}
|
|
162
|
+
// Add namespace import if target doesn't have one and source does
|
|
163
|
+
const sourceNamespaceImport = sourceImport.getNamespaceImport();
|
|
164
|
+
const targetNamespaceImport = targetImport.getNamespaceImport();
|
|
165
|
+
if (sourceNamespaceImport && !targetNamespaceImport) {
|
|
166
|
+
targetImport.setNamespaceImport(sourceNamespaceImport.getText());
|
|
167
|
+
}
|
|
168
|
+
// Merge named imports
|
|
169
|
+
const targetNamedImports = new Set(targetImport.getNamedImports().map((ni) => ni.getName()));
|
|
170
|
+
for (const sourceNamedImport of sourceImport.getNamedImports()) {
|
|
171
|
+
const importName = sourceNamedImport.getName();
|
|
172
|
+
if (!targetNamedImports.has(importName)) {
|
|
173
|
+
targetImport.addNamedImport({
|
|
174
|
+
name: importName,
|
|
175
|
+
alias: sourceNamedImport.getAliasNode()?.getText(),
|
|
176
|
+
isTypeOnly: sourceNamedImport.isTypeOnly(),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Remove duplicate named imports within each import declaration
|
|
183
|
+
*/
|
|
184
|
+
function deduplicateNamedImports(file) {
|
|
185
|
+
const allImports = file.getImportDeclarations();
|
|
186
|
+
for (const imp of allImports) {
|
|
187
|
+
const namedImports = imp.getNamedImports();
|
|
188
|
+
const seen = new Set();
|
|
189
|
+
for (const namedImport of namedImports) {
|
|
190
|
+
const name = namedImport.getName();
|
|
191
|
+
if (seen.has(name)) {
|
|
192
|
+
namedImport.remove();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
seen.add(name);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Remove imports from files marked with __delete__ prefix
|
|
202
|
+
* These imports reference deleted files and should be removed
|
|
203
|
+
*/
|
|
204
|
+
function removeDeleteMarkedImports(file) {
|
|
205
|
+
const DELETE_PREFIX = "__delete__";
|
|
206
|
+
const allImports = file.getImportDeclarations();
|
|
207
|
+
for (const imp of allImports) {
|
|
208
|
+
const moduleSpecifier = imp.getModuleSpecifierValue();
|
|
209
|
+
// Check if the module specifier contains __delete__ prefix
|
|
210
|
+
// This covers both direct paths like "./__delete__new" and path segments
|
|
211
|
+
if (moduleSpecifier.includes(DELETE_PREFIX)) {
|
|
212
|
+
imp.remove();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Ensure there's a blank line after the last import declaration
|
|
218
|
+
* This maintains proper formatting between imports and code
|
|
219
|
+
*/
|
|
220
|
+
function ensureBlankLineAfterImports(file) {
|
|
221
|
+
const imports = file.getImportDeclarations();
|
|
222
|
+
if (imports.length === 0) {
|
|
223
|
+
return; // No imports, nothing to do
|
|
224
|
+
}
|
|
225
|
+
const lastImport = imports[imports.length - 1];
|
|
226
|
+
// Get the next statement after imports (if any)
|
|
227
|
+
const statements = file.getStatements();
|
|
228
|
+
const lastImportIndex = statements.findIndex((stmt) => stmt === lastImport);
|
|
229
|
+
if (lastImportIndex === -1 || lastImportIndex === statements.length - 1) {
|
|
230
|
+
return; // Last import is the last statement, no code after it
|
|
231
|
+
}
|
|
232
|
+
const nextStatement = statements[lastImportIndex + 1];
|
|
233
|
+
// Check if there's already proper spacing
|
|
234
|
+
const fullText = file.getFullText();
|
|
235
|
+
const textBetween = fullText.substring(lastImport.getEnd(), nextStatement.getStart());
|
|
236
|
+
// Count newlines in the text between
|
|
237
|
+
const newlineCount = (textBetween.match(/\n/g) || []).length;
|
|
238
|
+
// We want at least 2 newlines (one ends the import, one creates blank line)
|
|
239
|
+
if (newlineCount < 2) {
|
|
240
|
+
// Insert additional newline after the last import
|
|
241
|
+
file.insertText(lastImport.getEnd(), "\n");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=import-merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-merger.js","sourceRoot":"","sources":["../../src/utils/import-merger.ts"],"names":[],"mappings":"AAOA;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,WAAuB,EAAE,UAAsB;IAC3E,MAAM,cAAc,GAAG,WAAW,CAAC,qBAAqB,EAAE,CAAC;IAC3D,MAAM,aAAa,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;IAEzD,6DAA6D;IAC7D,mEAAmE;IACnE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAqC,CAAC;IACtE,MAAM,sBAAsB,GAAyB,EAAE,CAAC;IAExD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,eAAe,GAAG,GAAG,CAAC,uBAAuB,EAAE,CAAC;QAEtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;YAC5C,gBAAgB,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACP,8DAA8D;YAC9D,sBAAsB,CAAC,IAAI,CAAC,GAAG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,CAAC,CAAC;IAEtD,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEtF,qCAAqC;IACrC,MAAM,YAAY,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IAE7D,4EAA4E;IAC5E,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACtB,kDAAkD;QAClD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function success(message: string): void;
|
|
2
|
+
export declare function error(message: string): void;
|
|
3
|
+
export declare function info(message: string): void;
|
|
4
|
+
export declare function warning(message: string): void;
|
|
5
|
+
export declare const warn: typeof warning;
|
|
6
|
+
export declare function heading(message: string): void;
|
|
7
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAOA,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,eAAO,MAAM,IAAI,gBAAU,CAAC;AAE5B,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
export function success(message) {
|
|
8
|
+
console.log(chalk.green("✓"), message);
|
|
9
|
+
}
|
|
10
|
+
export function error(message) {
|
|
11
|
+
console.error(chalk.red("✗"), message);
|
|
12
|
+
}
|
|
13
|
+
export function info(message) {
|
|
14
|
+
console.log(chalk.blue("ℹ"), message);
|
|
15
|
+
}
|
|
16
|
+
export function warning(message) {
|
|
17
|
+
console.log(chalk.yellow("⚠"), message);
|
|
18
|
+
}
|
|
19
|
+
export const warn = warning;
|
|
20
|
+
export function heading(message) {
|
|
21
|
+
console.log(chalk.bold.cyan(`\n${message}`));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,OAAO,CAAC,OAAe;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe;IACpC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAe;IACnC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAe;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAE5B,MAAM,UAAU,OAAO,CAAC,OAAe;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|