pas2js-3.2.21
Pascal to javascript translator based on free pascal compiler (fpc)
Usage
bin
Overview
Pas2JS Compiler version 1.5.1 [2025/02/08] for Linux x86_64 Copyright © 2019 Free Pascal team.
-
/pas2js-3.2.2 <your.pas>
Options
Put + after a boolean switch option to enable it, - to disable it
@<x>
|
: Read compiler options from file <x> in addition to the default |
|---|---|
|
pas2js.cfg |
-
-B -
: Rebuild all
|
: Defines the symbol <x>. Optional: |
|---|---|
|
: Write information and halt. <x> is a combination of the following: |
-
-iD -
: Write compiler date
-iSO : Write compiler OS
-iSP : Write compiler host processor
-iTO : Write target platform
-iTP : Write target processor
-
-iV -
: Write short compiler version
-
-iW -
: Write full compiler version
-
-ic -
: Write list of supported JS processors usable by
-P<x>
-
-im -
: Write list of supported modeswitches usable by
-M<x>
-
-io -
: Write list of supported optimizations usable by
-Oo<x>
-
-it -
: Write list of supported targets usable by
-T<x>
-
-iJ -
: Write list of supported JavaScript identifiers
-JoRTL-<x>
|
: Code generation options. <x> is a combination of the following |
|---|---|
|
letters: |
|
o
|
: Overflow checking of integer operations |
r
|
: Range checking |
R
|
: Object checks. Verify method calls and object type casts. |
-
-F... -
Set file names and paths:
-Fe<x>: Redirect output to file <x>. UTF-8 encoded.
-FE<x>: Set main output path to <x>
-Fi<x>: Add <x> to include paths
-FN<x>: add <x> to namespaces. Namespaces with trailing - are removed.
-
Delphi calls this flag "unit scope names".
-Fu<x>: Add <x> to unit paths
-FU<x>: Set unit output path to <x>
-I<x>-
: Add <x> to include paths, same as
-Fi
-
-J... -
Extra options of pas2js
-
-Jc -
: Write all JavaScript concatenated into the output file
-Je<x>: Encode messages as <x>.
-Jeconsole: Console codepage. This is the default.
-Jesystem : System codepage. On non Windows console and system are the
-
same.
-
-Jeutf-8 -
: Unicode UTF-8. Default when using
-Fe.
-
-JeJSON -
: Output compiler messages as JSON. Logo etc are outputted
-
as-is.
-Ji<x>: Insert JS file <x> into main JS file. E.g. -Jirtl.js. Can be given
-
multiple times. To remove a file name append a minus, e.g.
-Jirtl.js-.
-
-Jl -
: lower case identifiers
-
-Jm -
: generate source maps
-Jmsourceroot=<x>: use x as "sourceRoot", prefix URL for source file
-
names.
-Jmbasedir=<x>: write source file names relative to directory x, default
-
is map file folder.
-Jminclude: include Pascal sources in source map.
-Jmabsolute: store absolute filenames, not relative.
-Jmxssiheader: start source map with XSSI protection )]}', default.
-Jm-: disable generating source maps
-Jo<x>: Enable or disable extra option. The x is case insensitive:
-JoSearchLikeFPC: search source files like FPC, default: search case
-
insensitive.
-JoUseStrict: add "use strict" to modules, default.
-JoCheckVersion-: do not add rtl version check, default.
-JoCheckVersion=main: insert rtl version check into main.
-JoCheckVersion=system: insert rtl version check into system unit init.
-JoCheckVersion=unit: insert rtl version check into every unit init.
-JoRTL-<y>=<z>: set RTL identifier y to value z. See -iJ.
-Jr<x> Control writing of resource string file
-Jrnone: Do not write resource string file
-Jrunit: Write resource string file per unit with all resource strings
-Jrprogram: Write resource string file per program with all used
-
resource strings in program
-Jr<x> Control writing of linked resources
-JRnone: Do not write resources
-JRjs: Write resources in Javascript structure
-JRhtml[=filename] : Write resources as preload links in HTML file
-
(default is projectfile-res.html)
-Jpcmd<command>: Run postprocessor. For each generated js execute command
-
passing the js as stdin and read the new js from stdout. This option can be added multiple times to call several postprocessors in succession.
-Ju<x>: Add <x> to foreign unit paths. Foreign units are not compiled.
-JU: This pas2js does not support PCU files
-
-l -
: Write logo
-M<x>-
: Set language mode or enable/disable a modeswitch
-MDelphi: Delphi 7 compatibility mode
-MObjFPC: FPC's Object Pascal compatibility mode (default)
-M<x>-
: enable or disable modeswitch, see option
-im
-
Each mode (as listed above) enables its default set of modeswitches. Other modeswitches are disabled and need to be enabled one by another.
-NS<x> : obsolete: add <x> to namespaces. Same as -FN<x>
-
-n -
: Do not read the default config files
|
: Change main JavaScript file to <x>, "." means stdout |
|---|---|
|
: Optimizations: |
-
-O- -
: Disable optimizations
-
-O1 -
: Level 1 optimizations (quick and debugger friendly)
-Oo<x>: Enable or disable optimization. The x is case insensitive:
-OoEnumNumbers[-]: write enum value as number instead of name. Default
-
in
-O1.
-OoRemoveNotUsedPrivates[-]: Default is enabled
-OoRemoveNotUsedDeclarations[-]: Default enabled for programs with -Jc
-P<x>-
: Set target processor. Case insensitive:
-Pecmascript5: default
-Pecmascript6
|
: Syntax options. <x> is a combination of the following letters: |
|---|---|
2
|
: Same as |
a
|
: Turn on assertions |
c
|
: Support operators like C (*=,+=,/= and |
d
|
: Same as |
j
|
: Allows typed constants to be writeable (default) |
m
|
: Enables macro replacements |
|
: Set interface style to <x> |
-
-SIcom -
: COM, reference counted interface (default)
-SIcorba: CORBA interface
-T<x>-
: Set target platform
-Tbrowser: default
-Tnodejs : add pas.run(), includes -Jc
|
: Undefines the symbol <x> |
|---|---|
|
: Be verbose. <x> is a combination of the following letters: |
e
|
: Show errors (default) |
w
|
: Show warnings |
n
|
: Show notes |
h
|
: Show hints |
i
|
: Show info |
l
|
: Show line numbers, needs |
a
|
: Show everything |
0
|
: Show nothing (except errors) |
b
|
: Show file names with full path |
c
|
: Show conditionals |
t
|
: Show tried/used files |
d
|
: Show debug notes and info, enables |
q
|
: Show message numbers |
x
|
: Show used tools |
v
|
: Write pas2jsdebug.log with lots of debugging info |
z
|
: Write messages to stderr, |
-vm<x>,<y>: Do not show messages numbered <x> and <y>.
-
-? -
: Show this help
-
-h -
: Show this help
Environment variable PAS2JS_OPTS is parsed after default config and before
-
command line parameters.
Macros: Format is $Name, $Name$ or $Name()
-
$Pas2jsFullVersion: major.minor.release<extra> $Pas2jsVersion: major.minor.release $CfgDir: Use within a config file. The directory of this config file $Env(): environment variable, e.g. $Env(HOME)