Sign in Join
Wiki copytemporary

pas2js command line arguments: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: pas2js command line arguments

OldNewLine
1+[[Pascal]] to [[JavaScript]] transpiler [[pas2js]] [[Command-line interface|command line]] arguments
2+
3+## Options
4+
5+ Put + after a boolean switch option to enable it, - to disable it
6+ @<x> : Read compiler options from file <x> in addition to the default
7+ pas2js.cfg
8+ -B : Rebuild all
9+ -d<x> : Defines the symbol <x>. Optional: -d<x>:=<value>
10+ -i<x> : Write information and halt. <x> is a combination of the following:
11+ D : Write compiler date
12+ SO : Write compiler OS
13+ SP : Write compiler host processor
14+ TO : Write target platform
15+ TP : Write target processor
16+ V : Write short compiler version
17+ W : Write full compiler version
18+ -F... Set file names and paths:
19+ -Fe<x> : Redirect output to <x>. UTF-8 encoded.
20+ -Fi<x> : Add <x> to include paths
21+ -Fu<x> : Add <x> to unit paths
22+ -FU<x> : Set unit output path to <x>
23+ -I<x> : Add <x> to include paths, same as -Fi
24+ -J... Extra options of pas2js
25+ -Jc : Write all JavaScript concatenated into the output file
26+ -Je<x> : Encode messages as <x>.
27+ -Jeconsole : Console codepage. This is the default.
28+ -Jesystem : System codepage. On non Windows console and system are the same.
29+ -Jeutf-8 : Unicode UTF-8. Default when using -Fe.
30+ -Ji<x> : Insert JS file <x> into main JS file. E.g. -Jirtl.js. Can be
31+ given multiple times. To remove a file name append a minus, e.g.
32+ -Jirtl.js-.
33+ -Jl : lower case identifiers
34+ -Jm : generate source maps
35+ -Jmsourceroot=<x> : use x as "sourceRoot", prefix URL for source file names.
36+ -Jmbasedir=<x> : write source file names relative to directory x.
37+ -Jminclude : include Pascal sources in source map.
38+ -Jm- : disable generating source maps
39+ -Ju<x> : Add <x> to foreign unit paths. Foreign units are not compiled.
40+ -l : Write logo
41+ -MDelphi: Delphi 7 compatibility mode
42+ -MObjFPC: FPC's Object Pascal compatibility mode (default)
43+ -NS<x> : add <x> to namespaces. Namespaces with trailing - are removed.
44+ Delphi calls this flag "unit scope names".
45+ -n : Do not read the default config files
46+ -o<x> : Change main JavaScript file to <x>, "." means stdout
47+ -O<x> : Optimizations:
48+ -O- : Disable optimizations
49+ -O1 : Level 1 optimizations (quick and debugger friendly)
50+ -Oo<x> : Enable or disable optimization. The x is case insensitive:
51+ -OoEnumNumbers[-] : write enum value as number instead of name. Default in -O1.
52+ -OoRemoveNotUsedPrivates[-] : Default is enabled
53+ -OoRemoveNotUsedDeclarations[-] : Default enabled for programs with -Jc
54+ -P<x> : Set target processor. Case insensitive:
55+ -Pecmascript5 : default
56+ -Pecmascript6
57+ -S<x> : Syntax options. <x> is a combination of the following letters:
58+ c : Support operators like C (*=,+=,/= and -=)
59+ d : Same as -Mdelphi
60+ 2 : Same as -Mobjfpc (default)
61+ -T<x> : Set target platform
62+ -Tbrowser : default
63+ -Tnodejs : add pas.run(), includes -Jc
64+ -u<x> : Undefines the symbol <x>
65+ -v<x> : Be verbose. <x> is a combination of the following letters:
66+ e : show errors (default)
67+ w : show warnings
68+ n : show notes
69+ h : show hints
70+ i : show info
71+ l : show line numbers
72+ a : show everything
73+ 0 : show nothing (except errors)
74+ b : show file names with full path
75+ c : show conditionals
76+ t : show tried/used files
77+ d : show debug notes and info, enables -vni
78+ q : show message numbers
79+ x : show used tools
80+ -vm<x>,<y>: Do not show messages numbered <x> and <y>.
81+ -? : Show this help
82+ -h : Show this help
83+
84+ Macros: $Name, $Name$ or $Name()
85+ $Pas2jsFullVersion: major.minor.release<extra>
86+ $Pas2jsVersion: major.minor.release
87+ $Env(): environment variable, e.g. $Env(HOME)
88+ $CfgDir: Use within a config file. The directory of this config file
89+
90+## Config files
91+
92+- Empty lines are ignored
93+- Lines starting with hash+space '# ' are comments
94+- One option per line
95+- Directives are started by \#keyword, where keyword is case insensitive:
96+ - \#IFDEF macroname
97+ - \#IFNDEF macroname
98+ - \#IF expression - same as source directive \$if, except only macronames
99+ - \#ELSEIF
100+ - \#ELSE
101+ - \#ENDIF
102+ - \#ERROR text
103+
104+---
105+*From the Free Pascal wiki, page "pas2js command line arguments", as it stood on 2019-06-12 after a change by Djzepi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history