Bundling

Fry offers an integrated bundling tool for FatScript code.

Usage

To bundle your project into a single file starting from the entry point, execute:

fry -b sweet mySweetProject.fat

Subsequently, you can run your program:

./sweet

This process does the following:

  • Consolidates all imports, except for standard libraries and literal paths
  • Removes spaces and comments to enhance load times
  • Replaces any $break statements (debugger breakpoint) with ()
  • Adds a shebang to bundled code
  • Receives the execute attribute for file mode

Caveats

Imports are deduplicated and inlined based on their order of first appearance. Named modules are emitted at the bundle root even when first reached through a local import inside a method. Local handles are bound where the named imports occur, following the named import rules.

A named module reached through top-level local imports keeps its position relative to the code merged before it. Modules reached inside methods or other nested scopes may be moved ahead of the enclosing statement. Consequently, initialization timing can differ from running the source files directly.

Since v4.7.0, the bundler warns when a circular named import may initialize differently in a bundle. The warning does not reject the bundle; avoid depending on members of a module that is still initializing, and test both source and bundled execution when imports form a cycle.

bundles that bind local named-import handles use the ^ operator and require Fry v4.7.0 or later

Obfuscating

For optional obfuscation, use -o:

fry -o sweet mySweetProject.fat  # creates the obfuscated bundle
./sweet                          # executes your program as usual

when distributing via public hosts, consider setting a custom key with a local .fryrc; Only the client should be privy to this key to safeguard the source

Obfuscation leverages enigma algorithm for encryption, ensuring swift decoding. For optimal load times, prefer -b if obfuscation isn't essential.

results matching ""

    No results matching ""