@trayai/tray-sync-cli 0.0.11 → 0.0.13

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.
Files changed (33) hide show
  1. package/dist/commands/auth.js +1 -21
  2. package/dist/commands/init.js +1 -1
  3. package/dist/commands/promote.js +7 -5
  4. package/dist/lib/promoteReport.js +0 -21
  5. package/dist/views/auth/auth.js +22 -0
  6. package/dist/views/auth/auth.v2.js +30 -0
  7. package/dist/views/init/init.v2.js +20 -0
  8. package/dist/views/promote/promote.v2.js +37 -13
  9. package/dist/views/shared.js +2 -1
  10. package/package.json +5 -4
  11. package/node_modules/ansi-regex/index.d.ts +0 -33
  12. package/node_modules/ansi-regex/index.js +0 -14
  13. package/node_modules/ansi-regex/license +0 -9
  14. package/node_modules/ansi-regex/package.json +0 -61
  15. package/node_modules/ansi-regex/readme.md +0 -66
  16. package/node_modules/get-east-asian-width/index.d.ts +0 -60
  17. package/node_modules/get-east-asian-width/index.js +0 -30
  18. package/node_modules/get-east-asian-width/license +0 -9
  19. package/node_modules/get-east-asian-width/lookup-data.js +0 -21
  20. package/node_modules/get-east-asian-width/lookup.js +0 -138
  21. package/node_modules/get-east-asian-width/package.json +0 -71
  22. package/node_modules/get-east-asian-width/readme.md +0 -65
  23. package/node_modules/get-east-asian-width/utilities.js +0 -24
  24. package/node_modules/string-width/index.d.ts +0 -39
  25. package/node_modules/string-width/index.js +0 -207
  26. package/node_modules/string-width/license +0 -9
  27. package/node_modules/string-width/package.json +0 -65
  28. package/node_modules/string-width/readme.md +0 -66
  29. package/node_modules/strip-ansi/index.d.ts +0 -15
  30. package/node_modules/strip-ansi/index.js +0 -19
  31. package/node_modules/strip-ansi/license +0 -9
  32. package/node_modules/strip-ansi/package.json +0 -59
  33. package/node_modules/strip-ansi/readme.md +0 -37
@@ -1,12 +1,8 @@
1
1
  import { Command, InvalidArgumentError } from "commander";
2
2
  import { readCredentials, writeCredentials } from "../config/credentials.js";
3
- import { describeRegion } from "../lib/regionDisplay.js";
4
3
  import { parseRegion } from "../lib/regionParsing.js";
5
4
  import { isUuid } from "../lib/uuid.js";
6
- export function printAuthSetResult(stdout, result) {
7
- const verb = result.overwrote ? "Updated" : "Set";
8
- stdout(`${verb} token for workspace ${result.workspaceId} (${describeRegion(result.region)}).`);
9
- }
5
+ import { printAuthListResult, printAuthRemoveResult, printAuthSetResult } from "../views/auth/auth.v2.js";
10
6
  export async function runAuthSet(deps, options) {
11
7
  const { env, stdout } = deps;
12
8
  const credentials = await readCredentials(env);
@@ -19,13 +15,6 @@ export async function runAuthSet(deps, options) {
19
15
  printAuthSetResult(stdout, { workspaceId: options.workspaceId, region: options.region, overwrote });
20
16
  return 0;
21
17
  }
22
- export function printAuthRemoveResult(stdout, result) {
23
- if (!result.removed) {
24
- stdout(`No stored credentials for workspace ${result.workspaceId}. Nothing to remove.`);
25
- return;
26
- }
27
- stdout(`Removed stored credentials for workspace ${result.workspaceId}.`);
28
- }
29
18
  export async function runAuthRemove(deps, options) {
30
19
  const { env, stdout } = deps;
31
20
  const credentials = await readCredentials(env);
@@ -37,15 +26,6 @@ export async function runAuthRemove(deps, options) {
37
26
  printAuthRemoveResult(stdout, { workspaceId: options.workspaceId, removed });
38
27
  return 0;
39
28
  }
40
- export function printAuthListResult(stdout, result) {
41
- if (result.entries.length === 0) {
42
- stdout("No stored credentials.");
43
- return;
44
- }
45
- for (const entry of result.entries) {
46
- stdout(` ${entry.workspaceId} (${describeRegion(entry.region)})`);
47
- }
48
- }
49
29
  export async function runAuthList(deps, _options) {
50
30
  const { env, stdout } = deps;
51
31
  const credentials = await readCredentials(env);
@@ -10,7 +10,7 @@ import { PUBLIC_REGIONS, parseRegion } from "../lib/regionParsing.js";
10
10
  import { resolveToken } from "../lib/tokenResolution.js";
11
11
  import { isUuid } from "../lib/uuid.js";
12
12
  import { runPull } from "./pull.js";
13
- import { printConnectivityCheckFailed, printConnectivityCheckSucceeded, printNoTokenSkippingConnectivityAndPull, printTokenNotSaved, printTrayYamlAlreadyExists, } from "../views/init/init.js";
13
+ import { printConnectivityCheckFailed, printConnectivityCheckSucceeded, printNoTokenSkippingConnectivityAndPull, printTokenNotSaved, printTrayYamlAlreadyExists, } from "../views/init/init.v2.js";
14
14
  const SCOPES = Object.values(Scopes);
15
15
  function parseScope(value) {
16
16
  if (!SCOPES.includes(value)) {
@@ -12,13 +12,13 @@ import { readTrayYaml } from "../config/trayYaml.js";
12
12
  import { resolveContainedSafe } from "../lib/pathContainment.js";
13
13
  import { entityDisplayName } from "../lib/exportStructure.js";
14
14
  import { importProject, previewImport } from "../lib/promoteExecute.js";
15
- import { printProjectImportImpact, toProjectImportImpact, } from "../lib/promoteReport.js";
15
+ import { toProjectImportImpact } from "../lib/promoteReport.js";
16
16
  import { isFullyResolved, resolveProjectRequirements, scaffoldUnresolvedAuthentications, } from "../lib/promoteTarget.js";
17
17
  import { resolveToken } from "../lib/tokenResolution.js";
18
18
  import { isUuid } from "../lib/uuid.js";
19
19
  import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
20
20
  import { checkProjectDrift, DriftStatuses } from "./status.js";
21
- import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, } from "../views/promote/promote.v2.js";
21
+ import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectImportImpact, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, printWouldBePromoted, } from "../views/promote/promote.v2.js";
22
22
  import { printPromoteResultJson } from "../views/promote/shared.js";
23
23
  function findProjectDir(existingDirs, projectId) {
24
24
  return existingDirs.find((name) => name.split("--")[0] === projectId);
@@ -200,15 +200,17 @@ export async function runPromote(deps, options) {
200
200
  if (asJson) {
201
201
  promoted.push(impact);
202
202
  }
203
- else {
204
- printProjectImportImpact(stdout, impact);
205
- }
206
203
  if (options.dryRun) {
204
+ if (!asJson) {
205
+ printWouldBePromoted(stdout, projectId, sourceProjectName, options.to);
206
+ printProjectImportImpact(stdout, impact);
207
+ }
207
208
  continue;
208
209
  }
209
210
  await importProject(targetClient, targetProjectId, payload);
210
211
  if (!asJson) {
211
212
  printPromoted(stdout, projectId, sourceProjectName, options.to);
213
+ printProjectImportImpact(stdout, impact);
212
214
  }
213
215
  }
214
216
  catch (err) {
@@ -20,25 +20,4 @@ export function toProjectImportImpact(projectName, projectId, impact) {
20
20
  ],
21
21
  };
22
22
  }
23
- export function printProjectImportImpact(stdout, impact) {
24
- stdout(`${impact.projectName} (${impact.projectId})`);
25
- if (impact.workflows.length === 0) {
26
- stdout(" workflows: no changes");
27
- }
28
- else {
29
- stdout(" workflows:");
30
- for (const w of impact.workflows) {
31
- stdout(` ${w.kind}: ${w.name}${w.id ? ` (${w.id})` : ""}`);
32
- }
33
- }
34
- if (impact.config.length === 0) {
35
- stdout(" config: no changes");
36
- }
37
- else {
38
- stdout(" config:");
39
- for (const c of impact.config) {
40
- stdout(` ${c.kind}: ${c.name}`);
41
- }
42
- }
43
- }
44
23
  //# sourceMappingURL=promoteReport.js.map
@@ -0,0 +1,22 @@
1
+ import { describeRegion } from "../../lib/regionDisplay.js";
2
+ export function printAuthSetResult(stdout, result) {
3
+ const verb = result.overwrote ? "Updated" : "Set";
4
+ stdout(`${verb} token for workspace ${result.workspaceId} (${describeRegion(result.region)}).`);
5
+ }
6
+ export function printAuthRemoveResult(stdout, result) {
7
+ if (!result.removed) {
8
+ stdout(`No stored credentials for workspace ${result.workspaceId}. Nothing to remove.`);
9
+ return;
10
+ }
11
+ stdout(`Removed stored credentials for workspace ${result.workspaceId}.`);
12
+ }
13
+ export function printAuthListResult(stdout, result) {
14
+ if (result.entries.length === 0) {
15
+ stdout("No stored credentials.");
16
+ return;
17
+ }
18
+ for (const entry of result.entries) {
19
+ stdout(` ${entry.workspaceId} (${describeRegion(entry.region)})`);
20
+ }
21
+ }
22
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1,30 @@
1
+ import ansis from "ansis";
2
+ import Table from "cli-table3";
3
+ import { describeRegion } from "../../lib/regionDisplay.js";
4
+ import { INFO_ICON } from "../icons.js";
5
+ export function printAuthSetResult(stdout, result) {
6
+ const verb = result.overwrote ? "Updated" : "Set";
7
+ stdout(`${ansis.bold(verb)} token for workspace ${ansis.bold(result.workspaceId)} (${describeRegion(result.region)}).`);
8
+ }
9
+ export function printAuthRemoveResult(stdout, result) {
10
+ if (!result.removed) {
11
+ stdout(`${INFO_ICON} No stored credentials for workspace ${ansis.bold(result.workspaceId)}. Nothing to remove.`);
12
+ return;
13
+ }
14
+ stdout(`${ansis.bold("Removed")} stored credentials for workspace ${ansis.bold(result.workspaceId)}.`);
15
+ }
16
+ export function printAuthListResult(stdout, result) {
17
+ if (result.entries.length === 0) {
18
+ stdout(`${INFO_ICON} No stored credentials.`);
19
+ return;
20
+ }
21
+ const table = new Table({
22
+ head: ["ID", "Region"].map((h) => ansis.bold(h)),
23
+ style: { head: [] },
24
+ });
25
+ for (const entry of result.entries) {
26
+ table.push([ansis.bold(entry.workspaceId), describeRegion(entry.region)]);
27
+ }
28
+ stdout(table.toString());
29
+ }
30
+ //# sourceMappingURL=auth.v2.js.map
@@ -0,0 +1,20 @@
1
+ import ansis from "ansis";
2
+ import { FAILURE_ICON, INFO_ICON, SUCCESS_ICON, WARNING_ICON } from "../icons.js";
3
+ export function printTrayYamlAlreadyExists(stderr) {
4
+ stderr(`${FAILURE_ICON} ${ansis.bold("tray.yaml")} already exists in this directory. Refusing to overwrite.`);
5
+ }
6
+ export function printTokenNotSaved(stderr, workspaceId, region) {
7
+ stderr(`${WARNING_ICON} ${ansis.bold("--token")} was NOT saved\n` +
8
+ ` ${ansis.bold("credentials.json")} already has a token for workspace ${ansis.bold(workspaceId)}, and the existing one was kept.\n` +
9
+ ` tray.yaml has already been written, so \`${ansis.bold("tray init")}\` can't be re-run here — use \`${ansis.bold(`tray env add <name> --region ${region} --workspace-id ${workspaceId} --token <token> --force-token`)}\` to replace it, or edit ~/.tray/credentials.json directly.`);
10
+ }
11
+ export function printNoTokenSkippingConnectivityAndPull(stdout) {
12
+ stdout(`${INFO_ICON} ${ansis.bold("No")} token provided — skipping connectivity check and pull.`);
13
+ }
14
+ export function printConnectivityCheckSucceeded(stdout) {
15
+ stdout(`${SUCCESS_ICON} Connectivity check: connected`);
16
+ }
17
+ export function printConnectivityCheckFailed(stdout, message) {
18
+ stdout(`${FAILURE_ICON} Connectivity check: ${message}`);
19
+ }
20
+ //# sourceMappingURL=init.v2.js.map
@@ -1,46 +1,70 @@
1
1
  import ansis from "ansis";
2
- import { FAILURE_ICON } from "../icons.js";
2
+ import { FAILURE_ICON, INFO_ICON, SUCCESS_ICON } from "../icons.js";
3
3
  import { printIssueBlock } from "../shared.js";
4
4
  export function printMutuallyExclusiveResumeAndProject(stderr) {
5
- stderr("--resume and --project are mutually exclusive.");
5
+ stderr(`${FAILURE_ICON} ${ansis.bold("--resume")} and ${ansis.bold("--project")} are mutually exclusive.`);
6
6
  }
7
7
  export function printTrayYamlNotFound(stderr) {
8
- stderr("tray.yaml not found. Run `tray init` first.");
8
+ stderr(`${FAILURE_ICON} tray.yaml not found. Run \`${ansis.bold("tray init")}\` first.`);
9
9
  }
10
10
  export function printTargetEnvNotFound(stderr, envName) {
11
11
  stderr(`${FAILURE_ICON} Target environment "${ansis.bold(envName)}" not found. Run \`${ansis.bold(`tray env add ${envName} ...`)}\` first.`);
12
12
  }
13
13
  export function printError(stderr, message) {
14
- stderr(message);
14
+ stderr(`${FAILURE_ICON} ${message}`);
15
15
  }
16
16
  export function printProjectNotPulledLocally(stderr, projectId) {
17
- stderr(`Project ${projectId} has not been pulled locally. Run \`tray pull\` first.`);
17
+ stderr(`${FAILURE_ICON} Project ${ansis.bold(projectId)} has not been pulled locally. Run \`${ansis.bold("tray pull")}\` first.`);
18
18
  }
19
19
  export function printProjectNoStateFile(stderr, projectId) {
20
- stderr(`Project ${projectId} has no state.json. Run \`tray pull\` first.`);
20
+ stderr(`${FAILURE_ICON} Project ${ansis.bold(projectId)} has no state.json. Run \`${ansis.bold("tray pull")}\` first.`);
21
21
  }
22
22
  export function printLocalDrift(stderr, projectId, dirName, dirty) {
23
- printIssueBlock(stderr, `Project ${projectId} (${dirName}) has local drift; refusing to promote:`, dirty.map((d) => `${d.status}\t${d.path}`), "Run `tray pull` to refresh, or resolve the drift, then retry.");
23
+ printIssueBlock(stderr, `Project ${ansis.bold(`${projectId} (${dirName})`)} has local drift; refusing to promote:`, dirty.map((d) => `${d.status}\t${d.path}`), `Run \`${ansis.bold("tray pull")}\` to refresh, or resolve the drift, then retry.`);
24
24
  }
25
25
  export function printNoTargetProjectMapped(stderr, sourceProjectName, projectId, envName, mappingsPath) {
26
- stderr(`"${sourceProjectName}" (${projectId}) has no target project mapped for "${envName}".`);
27
- stderr(`Fill in target_project_id in ${mappingsPath}, or re-run with --auto-create-projects.`);
26
+ stderr(`${FAILURE_ICON} ${ansis.bold(`"${sourceProjectName}" (${projectId})`)} has no target project mapped for "${ansis.bold(envName)}".`);
27
+ stderr(`Fill in target_project_id in ${mappingsPath}, or re-run with ${ansis.bold("--auto-create-projects")}.`);
28
28
  }
29
29
  export function printInvalidAuthMappings(stderr, projectId, sourceProjectName, invalidAuthMappings) {
30
- printIssueBlock(stderr, `Project ${projectId} (${sourceProjectName}) has unresolved authentication mappings:`, invalidAuthMappings.map((invalid) => `${invalid.authExportId}: "${invalid.value}" is not a valid target authentication id`), "Fill in a real target authentication id for each entry above, then retry.");
30
+ printIssueBlock(stderr, `Project ${ansis.bold(`${projectId} (${sourceProjectName})`)} has unresolved authentication mappings:`, invalidAuthMappings.map((invalid) => `${ansis.bold(invalid.authExportId)}: "${invalid.value}" is not a valid target authentication id`), "Fill in a real target authentication id for each entry above, then retry.");
31
31
  }
32
32
  export function printUnresolvedRequirements(stderr, projectId, sourceProjectName, envName, unresolved) {
33
33
  const bulletLines = unresolved.unresolvedAuthentications.map((auth) => `unresolved authentication: ${auth.title} (${auth.authExportId})`);
34
34
  if (unresolved.hasNewConfigKeys) {
35
35
  bulletLines.push("new config keys require mapping");
36
36
  }
37
- printIssueBlock(stderr, `Project ${projectId} (${sourceProjectName}) has unresolved import requirements:`, bulletLines, `Run \`tray env resolve ${envName}\` to resolve, then retry.`);
37
+ printIssueBlock(stderr, `Project ${ansis.bold(`${projectId} (${sourceProjectName})`)} has unresolved import requirements:`, bulletLines, `Run \`${ansis.bold(`tray env resolve ${envName}`)}\` to resolve, then retry.`);
38
38
  }
39
39
  export function printPromoted(stdout, projectId, sourceProjectName, envName) {
40
- stdout(`Promoted project ${projectId} (${sourceProjectName}) to "${envName}"`);
40
+ stdout(`${SUCCESS_ICON} ${sourceProjectName} (${projectId}) ${ansis.bold("promoted")} to "${ansis.bold(envName)}"`);
41
+ }
42
+ export function printWouldBePromoted(stdout, projectId, sourceProjectName, envName) {
43
+ stdout(`${INFO_ICON} ${sourceProjectName} (${projectId}) would be promoted to "${ansis.bold(envName)}"`);
41
44
  }
42
45
  export function printProjectError(stderr, projectId, sourceProjectName, message, targetProjectId) {
43
46
  const target = targetProjectId ? ` -> target project ${targetProjectId}` : "";
44
- stderr(`Project ${projectId} (${sourceProjectName})${target}: ${message}`);
47
+ stderr(`${FAILURE_ICON} Project ${ansis.bold(`${projectId} (${sourceProjectName})`)}${target}: ${message}`);
48
+ }
49
+ export function printProjectImportImpact(stdout, impact) {
50
+ if (impact.workflows.length === 0) {
51
+ stdout(" workflows: no changes");
52
+ }
53
+ else {
54
+ stdout(" workflows:");
55
+ for (const w of impact.workflows) {
56
+ stdout(` ${ansis.bold(w.kind)}: ${w.name}${w.id ? ` (${w.id})` : ""}`);
57
+ }
58
+ }
59
+ if (impact.config.length === 0) {
60
+ stdout(" config: no changes");
61
+ }
62
+ else {
63
+ stdout(" config:");
64
+ for (const c of impact.config) {
65
+ stdout(` ${ansis.bold(c.kind)}: ${c.name}`);
66
+ }
67
+ }
68
+ stdout("");
45
69
  }
46
70
  //# sourceMappingURL=promote.v2.js.map
@@ -1,5 +1,6 @@
1
+ import { FAILURE_ICON } from "./icons.js";
1
2
  export function printIssueBlock(stderr, header, bulletLines, fixHint) {
2
- stderr(header);
3
+ stderr(`${FAILURE_ICON} ${header}`);
3
4
  for (const line of bulletLines) {
4
5
  stderr(`\t${line}`);
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayai/tray-sync-cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "CLI tool to clone Tray projects and related assets to a local directory, and promote them between Tray environments",
5
5
  "bin": {
6
6
  "tray": "dist/cli.js"
@@ -28,21 +28,22 @@
28
28
  "gallery:env": "tsc -p tsconfig.test.json && node dist-test/test/manual/envOutputGallery.js",
29
29
  "gallery:status": "tsc -p tsconfig.test.json && node dist-test/test/manual/statusOutputGallery.js",
30
30
  "gallery:pull": "tsc -p tsconfig.test.json && node dist-test/test/manual/pullOutputGallery.js",
31
- "gallery:project": "tsc -p tsconfig.test.json && node dist-test/test/manual/projectOutputGallery.js"
31
+ "gallery:project": "tsc -p tsconfig.test.json && node dist-test/test/manual/projectOutputGallery.js",
32
+ "gallery:init": "tsc -p tsconfig.test.json && node dist-test/test/manual/initOutputGallery.js",
33
+ "gallery:promote": "tsc -p tsconfig.test.json && node dist-test/test/manual/promoteOutputGallery.js",
34
+ "gallery:auth": "tsc -p tsconfig.test.json && node dist-test/test/manual/authOutputGallery.js"
32
35
  },
33
36
  "license": "Apache-2.0",
34
37
  "dependencies": {
35
38
  "ansis": "^4.3.1",
36
39
  "cli-table3": "^0.6.5",
37
40
  "commander": "~15.0.0",
38
- "string-width": "^8.2.2",
39
41
  "yaml": "~2.9.0"
40
42
  },
41
43
  "bundleDependencies": [
42
44
  "ansis",
43
45
  "cli-table3",
44
46
  "commander",
45
- "string-width",
46
47
  "yaml"
47
48
  ],
48
49
  "devDependencies": {
@@ -1,33 +0,0 @@
1
- export type Options = {
2
- /**
3
- Match only the first ANSI escape.
4
-
5
- @default false
6
- */
7
- readonly onlyFirst: boolean;
8
- };
9
-
10
- /**
11
- Regular expression for matching ANSI escape codes.
12
-
13
- @example
14
- ```
15
- import ansiRegex from 'ansi-regex';
16
-
17
- ansiRegex().test('\u001B[4mcake\u001B[0m');
18
- //=> true
19
-
20
- ansiRegex().test('cake');
21
- //=> false
22
-
23
- '\u001B[4mcake\u001B[0m'.match(ansiRegex());
24
- //=> ['\u001B[4m', '\u001B[0m']
25
-
26
- '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
27
- //=> ['\u001B[4m']
28
-
29
- '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
30
- //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
31
- ```
32
- */
33
- export default function ansiRegex(options?: Options): RegExp;
@@ -1,14 +0,0 @@
1
- export default function ansiRegex({onlyFirst = false} = {}) {
2
- // Valid string terminator sequences are BEL, ESC\, and 0x9c
3
- const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
4
-
5
- // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
6
- const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
7
-
8
- // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
9
- const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]';
10
-
11
- const pattern = `${osc}|${csi}`;
12
-
13
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
14
- }
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,61 +0,0 @@
1
- {
2
- "name": "ansi-regex",
3
- "version": "6.2.2",
4
- "description": "Regular expression for matching ANSI escape codes",
5
- "license": "MIT",
6
- "repository": "chalk/ansi-regex",
7
- "funding": "https://github.com/chalk/ansi-regex?sponsor=1",
8
- "author": {
9
- "name": "Sindre Sorhus",
10
- "email": "sindresorhus@gmail.com",
11
- "url": "https://sindresorhus.com"
12
- },
13
- "type": "module",
14
- "exports": "./index.js",
15
- "types": "./index.d.ts",
16
- "sideEffects": false,
17
- "engines": {
18
- "node": ">=12"
19
- },
20
- "scripts": {
21
- "test": "xo && ava && tsd",
22
- "view-supported": "node fixtures/view-codes.js"
23
- },
24
- "files": [
25
- "index.js",
26
- "index.d.ts"
27
- ],
28
- "keywords": [
29
- "ansi",
30
- "styles",
31
- "color",
32
- "colour",
33
- "colors",
34
- "terminal",
35
- "console",
36
- "cli",
37
- "string",
38
- "tty",
39
- "escape",
40
- "formatting",
41
- "rgb",
42
- "256",
43
- "shell",
44
- "xterm",
45
- "command-line",
46
- "text",
47
- "regex",
48
- "regexp",
49
- "re",
50
- "match",
51
- "test",
52
- "find",
53
- "pattern"
54
- ],
55
- "devDependencies": {
56
- "ansi-escapes": "^5.0.0",
57
- "ava": "^3.15.0",
58
- "tsd": "^0.21.0",
59
- "xo": "^0.54.2"
60
- }
61
- }
@@ -1,66 +0,0 @@
1
- # ansi-regex
2
-
3
- > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4
-
5
- ## Install
6
-
7
- ```sh
8
- npm install ansi-regex
9
- ```
10
-
11
- ## Usage
12
-
13
- ```js
14
- import ansiRegex from 'ansi-regex';
15
-
16
- ansiRegex().test('\u001B[4mcake\u001B[0m');
17
- //=> true
18
-
19
- ansiRegex().test('cake');
20
- //=> false
21
-
22
- '\u001B[4mcake\u001B[0m'.match(ansiRegex());
23
- //=> ['\u001B[4m', '\u001B[0m']
24
-
25
- '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
26
- //=> ['\u001B[4m']
27
-
28
- '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
29
- //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
30
- ```
31
-
32
- ## API
33
-
34
- ### ansiRegex(options?)
35
-
36
- Returns a regex for matching ANSI escape codes.
37
-
38
- #### options
39
-
40
- Type: `object`
41
-
42
- ##### onlyFirst
43
-
44
- Type: `boolean`\
45
- Default: `false` *(Matches any ANSI escape codes in a string)*
46
-
47
- Match only the first ANSI escape.
48
-
49
- ## Important
50
-
51
- If you run the regex against untrusted user input in a server context, you should [give it a timeout](https://github.com/sindresorhus/super-regex).
52
-
53
- **I do not consider [ReDoS](https://blog.yossarian.net/2022/12/28/ReDoS-vulnerabilities-and-misaligned-incentives) a valid vulnerability for this package.**
54
-
55
- ## FAQ
56
-
57
- ### Why do you test for codes not in the ECMA 48 standard?
58
-
59
- Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
60
-
61
- On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
62
-
63
- ## Maintainers
64
-
65
- - [Sindre Sorhus](https://github.com/sindresorhus)
66
- - [Josh Junon](https://github.com/qix-)
@@ -1,60 +0,0 @@
1
- export type WidthType = 'fullwidth' | 'halfwidth' | 'wide' | 'narrow' | 'neutral' | 'ambiguous';
2
-
3
- export type Options = {
4
- /**
5
- Whether to treat an `'ambiguous'` character as wide.
6
-
7
- @default true
8
-
9
- @example
10
- ```
11
- import {eastAsianWidth} from 'get-east-asian-width';
12
-
13
- const codePoint = '⛣'.codePointAt(0);
14
-
15
- console.log(eastAsianWidth(codePoint));
16
- //=> 1
17
-
18
- console.log(eastAsianWidth(codePoint, {ambiguousAsWide: true}));
19
- //=> 2
20
- ```
21
-
22
- > Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). __If the context cannot be established reliably, they should be treated as narrow characters by default.__
23
- > - http://www.unicode.org/reports/tr11/
24
- */
25
- readonly ambiguousAsWide?: boolean;
26
- };
27
-
28
- /**
29
- Returns the width as a number for the given code point.
30
-
31
- @param codePoint - A Unicode code point.
32
-
33
- @example
34
- ```
35
- import {eastAsianWidth} from 'get-east-asian-width';
36
-
37
- const codePoint = '字'.codePointAt(0);
38
-
39
- console.log(eastAsianWidth(codePoint));
40
- //=> 2
41
- ```
42
- */
43
- export function eastAsianWidth(codePoint: number, options?: Options): 1 | 2;
44
-
45
- /**
46
- Returns the type of “East Asian Width” for the given code point.
47
-
48
- @param codePoint - A Unicode code point.
49
-
50
- @example
51
- ```
52
- import {eastAsianWidthType} from 'get-east-asian-width';
53
-
54
- const codePoint = '字'.codePointAt(0);
55
-
56
- console.log(eastAsianWidthType(codePoint));
57
- //=> 'wide'
58
- ```
59
- */
60
- export function eastAsianWidthType(codePoint: number): WidthType;
@@ -1,30 +0,0 @@
1
- import {getCategory, isAmbiguous, isFullWidth, isWide} from './lookup.js';
2
-
3
- function validate(codePoint) {
4
- if (!Number.isSafeInteger(codePoint)) {
5
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
6
- }
7
- }
8
-
9
- export function eastAsianWidthType(codePoint) {
10
- validate(codePoint);
11
-
12
- return getCategory(codePoint);
13
- }
14
-
15
- export function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
16
- validate(codePoint);
17
-
18
- if (
19
- isFullWidth(codePoint)
20
- || isWide(codePoint)
21
- || (ambiguousAsWide && isAmbiguous(codePoint))
22
- ) {
23
- return 2;
24
- }
25
-
26
- return 1;
27
- }
28
-
29
- // Private exports for https://github.com/sindresorhus/is-fullwidth-code-point
30
- export {isFullWidth as _isFullWidth, isWide as _isWide} from './lookup.js';
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,21 +0,0 @@
1
- // Generated by scripts/build.js
2
-
3
- export const ambiguousMinimalCodePoint = 161;
4
- export const ambiguousMaximumCodePoint = 1114109;
5
- export const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
6
-
7
- export const fullwidthMinimalCodePoint = 12288;
8
- export const fullwidthMaximumCodePoint = 65510;
9
- export const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
10
-
11
- export const halfwidthMinimalCodePoint = 8361;
12
- export const halfwidthMaximumCodePoint = 65518;
13
- export const halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
14
-
15
- export const narrowMinimalCodePoint = 32;
16
- export const narrowMaximumCodePoint = 10630;
17
- export const narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
18
-
19
- export const wideMinimalCodePoint = 4352;
20
- export const wideMaximumCodePoint = 262141;
21
- export const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];