-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbrowserify.node_cli.txt
131 lines (121 loc) · 9.56 KB
/
browserify.node_cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
┏━━━━━━━━━━━━━━━━┓
┃ BROWSERIFY ┃
┗━━━━━━━━━━━━━━━━┛
VERSION ==> #Node module (10.2.4)
browserify [-r] PATH[:MDL]... #Returns JavaScript code that executes all MDL (like if they were concatenated), except
#MDL can contain require(STR) like Node.js:
# - use same algorithm, so can use Node.js modules in browser.
# package.json of modules can have those fields:
# - "browser":
# - like "main" but used only in Browserify. Usually "browser.js" vs "main.js"
# - can also be a { MDL: PATH ... } instead of main entry
# - PATH can be false, i.e. returns {}
# - can be used to alias PATH: see OBJ.paths below
# - "browserify": { "transform": MODULE_ARR }:
# - applies transform MODULE_ARR when this module is being required
# - scripts using global:
# - must use transform "browserify-shim" (3.8.9)
# - package.json PACKAGE.browserify-shim.FILE OBJ:
# - exports "[global:]VAR". Use "global:" when script is not bundled with the rest
# (e.g. loaded through separate <script> CDN). This will create WINDOW.MDL = VAR
# - depends MDL_ARR, with "MDL[:VAR]". USe ":VAR" for script expecting to find
# WINDOW.VAR (can only load its own dependency as global)
# or:
# - STR: same as { exports STR }
# - CONFIG.browserify-shim "MDL.js", exporting { MDL: OBJ }
# - can require Node built-in modules (using a browser shim):
# - global, __filename|dirname, process and buffer are already required by default
# - differences:
# - no IO, so no MODULE, READLINE, REPL, TTY, FS, CHILD_PROCESS, CLUSTER,
# DGRAM, NET, TLS, DNS
# - FS.readFile|readdir[Sync]() available with transform "brfs" (actually inlines
# the content compile-time) (1.4.0)
# - Error is DOM Error, not NODE
# - clear|setTimeout|Interval like DOM, clear|setImmediate not existing
# - EVENTS = EVENTS.EventEmitter
# - BUFFER: do not use instanceof Buffer (but isBuffer())
# - DOMAIN: no members()
# - HTTP[S]: no createServer() (only client-side)
# - PROCESS: only nextTick()
# - CRYPTO: no createCredentials()
# - OS: limited:
# - no cpus(), hostname(), uptime(), loadavg(), *mem(), networkInterfaces()
# - arch() -> "javascript", type() -> "Browser", platform() -> "browser",
# release() -> user agent
#Output code:
# - is typically included in a single <script src="bundle.js"></script>
# - can be minified
# - is single output except:
# - transform "factor-bundle" (2.4.1) with options -o PATH2:
# browserify PATHa PATHb -p [ factor-bundle -o PATH2a -o PATH2b ] -o PATH3
# Can then only require PATHa by loading PATH2a + PATH3
--require=PATH[:MDL] #Instead of executing code, bundle will define code so that require(MDL) executes MDL
#(and returns its module.exports).
#Can be done several times
--output PATH #Output (déf: stdout)
--debug #Adds a source map at end of the file as Data URI
--standalone STR #Uses a UMD wrapper, with root.STR for global variables.
--ignore GEXP #Replace dependencies by empty stub {}
--exclude GEXP #Removes a dependency
--transform MODULE #Be MODULE a FUNC(IOSTREAM) -> IOSTREAM2, transform all require(...) using this FUNC()
#Pass arguments as [ MODULE --VAR ... ] (in Node: ["MODULE", OBJ])
--command MODULE #Same but use a command line taking from stdin and outputting to stdout instead
--plugin=MODULE #Same as transform but as a FUNC(BUNDLE, OBJ) -> BUNDLE
--noparse=PATH #Speed up building PATH, but it must not have any require()
--insert-global-vars VAR,... #
--extension=EXT #Which extension to consider by require() lookup (can be specified several times)
#(déf: [ ".js", ".json" ])
--deps #Prints dependency graph
--list #Similar
BROWSERIFY(ISTRM|PATH[_ARR][,OBJ])#Returns a BUNDLE, for the files specified by ISTREAM|PATH[_ARR] or OBJ.entries PATH[_ARR]
#OBJ members are:
# - basedir DIR: $PWD used for relative paths. Necessary for ISTREAM[_ARR]
# - paths { MDL: PATH } (like RequireJS map). Relative to basedir.
# Can also set ENVVAR NODE_PATH
# - same options as command line
#With Gulp, do BROWSERIFY(PATH).bundle(...).pipe(VINYL-SOURCE-STREAM(PATH)), then continue
#the Gulp chain.
BUNDLE.add(ISTRM|PATH[_ARR][,OBJ])#Adds files
BUNDLE.bundle([OBJ #Returns as IOSTREAM
[, FUNC(ERROR, BUFFER)]]) #Can get the results when available also with FUNC()
#OBJ members are:
# - debug BOOL: like browserify --debug
# - standalone STR: like browserify --standalone STR
BUNDLE.transform([OBJ, ] #Like browserify --transform MODULE
FUNC|MODULE) #If OBJ.global is true, do it not only on first-level require(), but also dependencies
#require()
BUNDLE.ignore|exclude(ISTREAM) #
BUNDLE.plugin(FUNC|MODULE[, OBJ]) #Like browserify --bundle MODULE. Must be called before .bundle()
watchify ... #Node module (3.2.3).
#Like browserify ... but:
# - watch mode
# - extra options:
--verbose #
--delay NUM #Throttle "update" event
--ignore-watch=GLOB #Def: "**/node_modules/**"
--poll=NUM #In ms, instead of default event triggering.
WATCHIFY(BROWSERIFY(...)[, OBJ]) #Fires events:
# - update(BUNDLE_ID_ARR): should then call BUNDLE.bundle()
# - time(NUM): how many ms it took to bundle
# - bytes(NUM): same for bundle size
# - log(STR): same as log string
beefy #Similar but hosts on a local server
budo #Same but also works with LiveReload
browserify-middleware #Express MDW doing BROWSERIFY() on static JavaScript assets
loadjs(MDL_ARR) #Dynamic loading with node module partition-bundle 1.3.0
#Must use transform "partition-bundle" with options:
# --map JSON_FILE: with members PATH: MDL_ARR
# --main PATH: main output
# --output DIR
# --url DIR
debowerify #Node module (0.7.1)
#Transform allowing require() on Bower packages
deamdify #Node module (0.1.1)
#Transform allowing require(...) on AMD modules
EXORCIST(PATH[,STR[,STR2[,PAT2]]])#Node module (0.4.0)
#Transform qui extrait la source map créée par --debug vers un fichier PATH.
# - STR et STR2: changer sourceUrl et sourceRoot.
# - PATH2: baseURL for relative paths
#Can fire event missing-map()
#Can also use command line exorcist PATH [-u STR] [-r STR2] [-b PATH2]
#With Gulp, do .pipe(VINYL-TRANSFORM(EXORCIST(...)))