@ugo-studio/jspp 0.2.0 → 0.2.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/dist/cli.js CHANGED
@@ -7,6 +7,7 @@ import { COLORS } from "./cli-utils/colors";
7
7
  import { getLatestMtime } from "./cli-utils/file-utils";
8
8
  import { Spinner } from "./cli-utils/spinner";
9
9
  import { Interpreter } from "./index";
10
+ const pkgDir = path.dirname(__dirname);
10
11
  async function main() {
11
12
  const { jsFilePath, isRelease, keepCpp, outputExePath, scriptArgs } = parseArgs(process.argv.slice(2));
12
13
  const jsFileName = path.basename(jsFilePath, ".js");
@@ -26,13 +27,11 @@ async function main() {
26
27
  const mode = isRelease ? "release" : "debug";
27
28
  console.log(`${COLORS.bold}JSPP Compiler${COLORS.reset} ${COLORS.dim}v${pkg.version}${COLORS.reset}`);
28
29
  console.log(`Mode: ${isRelease ? COLORS.green : COLORS.yellow}${mode.toUpperCase()}${COLORS.reset}\n`);
29
- const flags = isRelease
30
- ? ["-O3", "-DNDEBUG"]
31
- : ["-O0"];
30
+ const flags = isRelease ? ["-O3", "-DNDEBUG"] : ["-O0"];
32
31
  if (process.platform === "win32") {
33
32
  flags.push("-Wa,-mbig-obj");
34
33
  }
35
- const pchDir = path.resolve(process.cwd(), "prelude-build", mode);
34
+ const pchDir = path.resolve(pkgDir, "prelude-build", mode);
36
35
  const spinner = new Spinner("Initializing...");
37
36
  try {
38
37
  spinner.start();
@@ -44,7 +43,7 @@ async function main() {
44
43
  const { cppCode, preludePath } = interpreter.interpret(jsCode);
45
44
  // Ensure directory for cpp file exists (should exist as it's source dir, but for safety if we change logic)
46
45
  await fs.mkdir(path.dirname(cppFilePath), { recursive: true });
47
- // await fs.writeFile(cppFilePath, cppCode);
46
+ await fs.writeFile(cppFilePath, cppCode);
48
47
  spinner.succeed(`Generated cpp`);
49
48
  // 2. Precompiled Header Check
50
49
  spinner.text = "Checking precompiled headers...";
@@ -68,6 +67,7 @@ async function main() {
68
67
  cmd: ["bun", "run", "scripts/precompile-headers.ts"],
69
68
  stdout: "pipe", // pipe to hide output unless error, or handle differently
70
69
  stderr: "pipe",
70
+ cwd: pkgDir,
71
71
  });
72
72
  const exitCode = await rebuild.exited;
73
73
  if (exitCode !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ugo-studio/jspp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A modern transpiler that converts JavaScript code into high-performance, standard C++23.",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.ts",
@@ -7,13 +7,8 @@
7
7
  #include "values/shape.hpp"
8
8
  #include "values/symbol.hpp"
9
9
  #include "values/non_values.hpp"
10
- // #include "any_value.hpp"
11
- // #include "values/object.hpp"
12
- // #include "values/array.hpp"
13
- // #include "values/function.hpp"
14
10
  #include "values/iterator.hpp"
15
11
  #include "values/async_iterator.hpp"
16
- // #include "values/promise.hpp"
17
12
  #include "values/string.hpp"
18
13
 
19
14
  #include "any_value.hpp"