Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launching #2

Closed
tuk2 opened this issue Feb 21, 2025 · 2 comments
Closed

Launching #2

tuk2 opened this issue Feb 21, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@tuk2
Copy link

tuk2 commented Feb 21, 2025

Describe the bug

Thank you for your work!
Could you please provide a detailed guide on how to launch the "obfuscator"? I am having trouble launching it on a new server with the Quick Start (Usage Example), possibly due to ts incompatibilities, but I haven't figured it out yet.

Expected Behaviour

node index.js
node:internal/errors:478
ErrorCaptureStackTrace(err);
^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /root/enigma2/node_modules/enigma-vm/index.d.ts
at new NodeError (node:internal/errors:387:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:75:11)
at defaultGetFormat (node:internal/modules/esm/get_format:117:38)
at defaultLoad (node:internal/modules/esm/load:81:20)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:605:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:63:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Code

import { Compiler, ProgramBuilder } from "enigma-vm";

(async function () {
  const compiler = new Compiler();

  const input = `
    function sayHello(name) {
        console.log("Hello,", name + "!");
    }

    for (let i = 0; i < 3; i++) {
        sayHello("Me and " + i);
    }
  `;

  compiler.compile(input);

  const bytecode = compiler.constructBytecode();
  const code = await new ProgramBuilder().build(bytecode);

  console.log(code);
})();

Logs

tsc index.ts
node_modules/enigma-vm/Sources/Compiler/Compiler.ts:338:61 - error TS2550: Property 'toReversed' does not exist on type 'ControlBlock[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.

338         const reversedControlBlock = this.controlBlockStack.toReversed();
                                                                ~~~~~~~~~~

node_modules/enigma-vm/Sources/Compiler/Compiler.ts:362:94 - error TS2550: Property 'toReversed' does not exist on type 'ControlBlock[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.

362           for (const { continue: continueLabel, label: labelName } of this.controlBlockStack.toReversed()) {
                                                                                                 ~~~~~~~~~~

node_modules/enigma-vm/Sources/Compiler/Compiler.ts:369:76 - error TS2550: Property 'toReversed' does not exist on type 'ControlBlock[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.

369           for (const { continue: continueLabel } of this.controlBlockStack.toReversed()) {
                                                                               ~~~~~~~~~~

node_modules/enigma-vm/Sources/Compiler/Compiler.ts:677:82 - error TS2550: Property 'toReversed' does not exist on type 'Try[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.

677         for (const { catch: catchLabel, finally: finallyLabel } of this.tryStack.toReversed()) {
                                                                                     ~~~~~~~~~~

node_modules/enigma-vm/Sources/ProgramBuilder/Bytecode/BytecodeTranscoderProvider.ts:7:18 - error TS2550: Property 'toSorted' does not exist on type 'T[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2023' or later.

7     return array.toSorted(() => Math.random() - 0.5);
                   ~~~~~~~~

node_modules/enigma-vm/Sources/ProgramBuilder/Templates/Template.ts:51:36 - error TS2802: Type 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.

51     for (const requiredVariable of this.requiredVariables) {
                                      ~~~~~~~~~~~~~~~~~~~~~~


Found 6 errors in 3 files.

Errors  Files
     4  node_modules/enigma-vm/Sources/Compiler/Compiler.ts:338
     1  node_modules/enigma-vm/Sources/ProgramBuilder/Bytecode/BytecodeTranscoderProvider.ts:7
     1  node_modules/enigma-vm/Sources/ProgramBuilder/Templates/Template.ts:51
root@ns31545937:~/enigma2# ^C
root@ns31545937:~/enigma2# node index.
node:internal/modules/cjs/loader:1031
  throw err;
  ^
@tuk2 tuk2 added the bug Something isn't working label Feb 21, 2025
@youdie323323
Copy link
Owner

youdie323323 commented Feb 21, 2025

Hey, sorry for the late response. I’ve just released a new version, [email protected], with babel-polyfilled javascript. Let me know if this resolves the issue!

@tuk2
Copy link
Author

tuk2 commented Feb 21, 2025

Thanks you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants