@danielx/civet 0.4.19-pre.10 → 0.4.19-pre.12

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/civet CHANGED
@@ -5,6 +5,28 @@ if (process.argv.includes("--version")) {
5
5
  process.stdout.write(require("../package.json").version + "\n");
6
6
  process.exit(0);
7
7
  }
8
+ if (process.argv.includes("--help")) {
9
+ process.stdout.write(` \u2584\u2584\xB7 \u25AA \u258C \u2590\xB7\u2584\u2584\u2584 .\u2584\u2584\u2584\u2584\u2584
10
+ \u2590\u2588 \u258C\u25AA\u2588\u2588 \u25AA\u2588\xB7\u2588\u258C\u2580\u2584.\u2580\xB7\u2022\u2588\u2588 _._ _,-'""\`-._
11
+ \u2588\u2588 \u2584\u2584\u2590\u2588\xB7\u2590\u2588\u2590\u2588\u2022\u2590\u2580\u2580\u25AA\u2584 \u2590\u2588.\u25AA (,-.\`._,'( |\\\`-/|
12
+ \u2590\u2588\u2588\u2588\u258C\u2590\u2588\u258C \u2588\u2588\u2588 \u2590\u2588\u2584\u2584\u258C \u2590\u2588\u258C\xB7 \`-.-' \\ )-\`( , o o)
13
+ \xB7\u2580\u2580\u2580 \u2580\u2580\u2580. \u2580 \u2580\u2580\u2580 \u2580\u2580\u2580 \`- \\\`_\`"'-
14
+
15
+
16
+ Usage:
17
+
18
+ civet [options] < input.civet > output.ts
19
+
20
+ Options:
21
+ --help Show this help message
22
+ --version Show the version number
23
+ --ast Output the AST instead of the compiled code
24
+ --inline-map Generate a sourcemap
25
+ --js Strip out all type annotations
26
+
27
+ `);
28
+ process.exit(0);
29
+ }
8
30
  ({ parse, compile, generate } = require("./main"));
9
31
  ({ prune } = generate);
10
32
  encoding = "utf8";
@@ -34,21 +56,20 @@ readLines = function(rl) {
34
56
  });
35
57
  };
36
58
  readLines(readline.createInterface(process.stdin)).then(function(input) {
37
- var ast, filename, inlineMap, js, output;
38
- process.argv.includes("--ast");
39
- js = process.argv.includes("--js");
59
+ var ast, cache, filename, inlineMap, js, output;
60
+ ast = process.argv.includes("--ast");
61
+ cache = !process.argv.includes("--no-cache");
40
62
  inlineMap = process.argv.includes("--inline-map");
63
+ js = process.argv.includes("--js");
41
64
  filename = "unknown";
42
65
  try {
43
66
  filename = fs.realpathSync("/dev/stdin");
44
67
  } catch (error) {
45
68
  }
69
+ output = compile(input, { ast, cache, filename, inlineMap, js });
46
70
  if (ast) {
47
- ast = prune(parse(input, { filename }));
48
- process.stdout.write(JSON.stringify(ast, null, 2));
49
- process.exit(0);
71
+ output = JSON.stringify(output, null, 2);
50
72
  }
51
- output = compile(input, { filename, js, inlineMap });
52
73
  return process.stdout.write(output);
53
74
  }).catch(function(e) {
54
75
  console.error(e);
@@ -27,9 +27,9 @@ module.exports = {
27
27
  return {
28
28
  errors: [{
29
29
  text: e.message
30
- }],
30
+ }]
31
31
  }
32
32
  }
33
33
  })
34
- },
34
+ }
35
35
  }
package/dist/esm.mjs CHANGED
@@ -52,7 +52,7 @@ function ensureRegister () {
52
52
  path = normalizeSlashes(path)
53
53
 
54
54
  return outputCache.get(path)
55
- },
55
+ }
56
56
  }
57
57
 
58
58
  sourceMapSupport.install(installation)