@delance/builder 0.2.16 → 0.3.1

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/README.md CHANGED
@@ -12,7 +12,7 @@ A spear to the Python language server built with black magic.
12
12
  ## Usage
13
13
 
14
14
  - API
15
- ```typescript
15
+ ```javascript
16
16
  import run from '@delance/builder';
17
17
  ```
18
18
 
package/dist/cli.js CHANGED
@@ -14,17 +14,17 @@ import { isatty } from "node:tty";
14
14
  var argv = process.argv || [];
15
15
  var { env } = process;
16
16
  var enabled = !(("NO_COLOR" in env) || argv.includes("--no-color")) && (("FORCE_COLOR" in env) || argv.includes("--color") || process.platform === "win32" || isatty(1) && env.TERM !== "dumb" || ("CI" in env));
17
- var formatter = (open, close, replace = open) => enabled ? (input) => {
18
- const string = String(input);
19
- const index = string.indexOf(close, open.length);
20
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
21
- } : String;
22
17
  var replaceClose = (string, close, replace, index) => {
23
18
  const start = string.slice(0, Math.max(0, index)) + replace;
24
19
  const end = string.slice(Math.max(0, index + close.length));
25
20
  const nextIndex = end.indexOf(close);
26
21
  return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
27
22
  };
23
+ var formatter = (open, close, replace = open) => enabled ? (input) => {
24
+ const string = String(input);
25
+ const index = string.indexOf(close, open.length);
26
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
27
+ } : String;
28
28
  var bold = /* @__PURE__ */ formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m");
29
29
  var dim = /* @__PURE__ */ formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m");
30
30
  var underline = /* @__PURE__ */ formatter("\x1B[4m", "\x1B[24m");
@@ -60,7 +60,7 @@ function hl(..._arguments) {
60
60
  return;
61
61
  }
62
62
  if (true) {
63
- if (argument.startsWith('"') && argument.endsWith('"') || argument.startsWith("\'") && argument.endsWith("\'")) {
63
+ if (argument.startsWith('"') && argument.endsWith('"') || argument.startsWith("'") && argument.endsWith("'")) {
64
64
  yield argument[0] + magenta(argument.slice(1, -1)) + argument[0];
65
65
  continue;
66
66
  }
@@ -73,22 +73,22 @@ var errorMessage = `
73
73
  ${red("Uh-oh")}. ${bold(yellow("@delance/builder"))} CLI requires Bun to run.
74
74
  If you were trying to run the language server, use ${bold(magenta("npm i @delance/runtime"))}.
75
75
 
76
- \u2022 To install Bun:
76
+ To install Bun:
77
77
  ${hl("npm", "i", "-d", "bun", "#", "locally")}
78
78
  ${hl("curl", "-fsSL", "https://bun.sh/install", "|", "bash", "#", "globally")}
79
- \u2022 More info: ${underline(cyan("https://bun.sh/docs/installation"))}
79
+ More info: ${underline(cyan("https://bun.sh/docs/installation"))}
80
80
 
81
- ${"\u2500".repeat(80)}
81
+ ${"".repeat(80)}
82
82
  `;
83
83
  if (!process.isBun) {
84
84
  const { status, error } = spawnSync("bun", ["run", ...process.argv.slice(1)], { stdio: "inherit" });
85
- if (status) {
86
- process.exit(status);
87
- } else {
88
- if (error && error.code === "ENOENT") {
85
+ if (error) {
86
+ if (error.code === "ENOENT") {
89
87
  console.error(errorMessage);
90
88
  }
91
89
  throw error;
90
+ } else {
91
+ process.exit(status);
92
92
  }
93
93
  }
94
94
  async function main(argv2) {