trunk 0.21.14

Build, bundle & ship your Rust WASM application to the web.
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Configuration",
  "description": "The persisted Trunk configuration model",
  "type": "object",
  "properties": {
    "build": {
      "default": {
        "accept_invalid_certs": false,
        "all_features": false,
        "allow_self_closing_script": false,
        "cargo_profile": null,
        "create_nonce": false,
        "dist": "dist",
        "filehash": true,
        "frozen": false,
        "html_output": "index.html",
        "inject_scripts": true,
        "locked": false,
        "minify": "never",
        "no_default_features": false,
        "no_sri": false,
        "nonce_placeholder": "{{__TRUNK NONCE__}}",
        "offline": false,
        "public_url": "/",
        "public_url_no_trailing_slash_fix": false,
        "release": false,
        "target": "index.html"
      },
      "allOf": [
        {
          "$ref": "#/definitions/Build"
        }
      ]
    },
    "clean": {
      "default": {
        "cargo": false
      },
      "allOf": [
        {
          "$ref": "#/definitions/Clean"
        }
      ]
    },
    "dist": {
      "default": null,
      "type": [
        "string",
        "null"
      ]
    },
    "hooks": {
      "default": [],
      "allOf": [
        {
          "$ref": "#/definitions/Hooks"
        }
      ]
    },
    "proxies": {
      "$ref": "#/definitions/Proxies"
    },
    "serve": {
      "$ref": "#/definitions/Serve"
    },
    "tools": {
      "$ref": "#/definitions/Tools"
    },
    "trunk_version": {
      "default": "*",
      "allOf": [
        {
          "$ref": "#/definitions/VersionReq"
        }
      ]
    },
    "watch": {
      "$ref": "#/definitions/Watch"
    }
  },
  "definitions": {
    "AddressFamily": {
      "type": "string",
      "enum": [
        "ipv4",
        "ipv6"
      ]
    },
    "BaseUrl": {
      "type": "string",
      "format": "uri"
    },
    "Build": {
      "description": "Config options for the build system.",
      "type": "object",
      "properties": {
        "accept_invalid_certs": {
          "description": "Allows request to ignore certificate validation errors.\n\nCan be useful when behind a corporate proxy.",
          "default": false,
          "type": "boolean"
        },
        "all_features": {
          "description": "Build with all features",
          "default": false,
          "type": "boolean"
        },
        "allow_self_closing_script": {
          "description": "Ignore error's related to self-closing script elements, and instead issue a warning.\n\nSince this issue can cause the HTML output to be truncated, only enable this in case you are sure it is caused due to a false positive.",
          "default": false,
          "type": "boolean"
        },
        "cargo_profile": {
          "description": "Cargo profile to use.\n\nOverrides the default chosen by cargo. Ignored if the 'index.html' has one configured.",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "create_nonce": {
          "description": "Create 'nonce' attributes with a placeholder.",
          "default": false,
          "type": "boolean"
        },
        "dist": {
          "description": "The output dir for all final assets",
          "default": "dist",
          "type": "string"
        },
        "example": {
          "description": "Whether to build an example.",
          "type": [
            "string",
            "null"
          ]
        },
        "features": {
          "description": "A comma-separated list of features to activate, must not be used with all-features",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "filehash": {
          "description": "Whether to include hash values in the output file names",
          "default": true,
          "type": "boolean"
        },
        "frozen": {
          "description": "Require Cargo.lock and cache are up to date",
          "default": false,
          "type": "boolean"
        },
        "html_output": {
          "description": "The name of the output HTML file.\n\nIf not set, the file is named \"index.html\"",
          "default": "index.html",
          "type": "string"
        },
        "inject_scripts": {
          "description": "Whether to inject scripts into your index file.\n\nThese values can only be provided via config file.",
          "default": true,
          "type": "boolean"
        },
        "locked": {
          "description": "Require Cargo.lock is up to date",
          "default": false,
          "type": "boolean"
        },
        "minify": {
          "description": "Control minification.",
          "default": "never",
          "allOf": [
            {
              "$ref": "#/definitions/Minify"
            }
          ]
        },
        "no_default_features": {
          "description": "Build without default features",
          "default": false,
          "type": "boolean"
        },
        "no_sri": {
          "description": "Allows disabling sub-resource integrity (SRI)",
          "default": false,
          "type": "boolean"
        },
        "nonce_placeholder": {
          "description": "The placeholder which is used in the 'nonce' attribute.",
          "default": "{{__TRUNK NONCE__}}",
          "type": "string"
        },
        "offline": {
          "description": "Run without accessing the network",
          "default": false,
          "type": "boolean"
        },
        "pattern_params": {
          "description": "Optional replacement parameters corresponding to the patterns provided in `pattern_script` and `pattern_preload`.\n\nWhen a pattern is being replaced with its corresponding value from this map, if the value is prefixed with the symbol `@`, then the value is expected to be a file path, and the pattern will be replaced with the contents of the target file. This allows insertion of some big JSON state or even HTML files as a part of the `index.html` build.\n\nTrunk will automatically insert the `base`, `wasm` and `js` key/values into this map. In order for the app to be loaded properly, the patterns `{base}`, `{wasm}` and `{js}` should be used in `pattern_script` and `pattern_preload`.\n\nThese values can only be provided via config file.",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "pattern_preload": {
          "description": "Optional pattern for the app preload element [default: None]\n\nPatterns should include the sequences `{base}`, `{wasm}`, and `{js}` in order to properly preload the application. Other sequences may be included corresponding to key/value pairs provided in `pattern_params`.\n\nThese values can only be provided via config file.",
          "type": [
            "string",
            "null"
          ]
        },
        "pattern_script": {
          "description": "Optional pattern for the app loader script [default: None]\n\nPatterns should include the sequences `{base}`, `{wasm}`, and `{js}` in order to properly load the application. Other sequences may be included corresponding to key/value pairs provided in `pattern_params`.\n\nThese values can only be provided via config file.",
          "type": [
            "string",
            "null"
          ]
        },
        "public_url": {
          "description": "The public URL from which assets are to be served",
          "default": "/",
          "allOf": [
            {
              "$ref": "#/definitions/BaseUrl"
            }
          ]
        },
        "public_url_no_trailing_slash_fix": {
          "description": "Don't add a trailing slash to the public URL if it is missing",
          "default": false,
          "type": "boolean"
        },
        "release": {
          "description": "Build in release mode [default: false]",
          "default": false,
          "type": "boolean"
        },
        "root_certificate": {
          "description": "When desired, set a custom root certificate chain (same format as Cargo's config.toml http.cainfo)",
          "type": [
            "string",
            "null"
          ]
        },
        "target": {
          "description": "The index HTML file to drive the bundling process",
          "default": "index.html",
          "type": "string"
        }
      }
    },
    "Clean": {
      "description": "Config options for the serve system.",
      "type": "object",
      "properties": {
        "cargo": {
          "description": "Optionally perform a cargo clean",
          "default": false,
          "type": "boolean"
        },
        "dist": {
          "description": "The output dir for all final assets",
          "deprecated": true,
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "Hook": {
      "description": "Config options for build system hooks.",
      "type": "object",
      "required": [
        "command",
        "stage"
      ],
      "properties": {
        "command": {
          "description": "The command to run for this hook.",
          "type": "string"
        },
        "command_arguments": {
          "description": "Any arguments to pass to the command.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "linux": {
          "anyOf": [
            {
              "$ref": "#/definitions/HookOverride"
            },
            {
              "type": "null"
            }
          ]
        },
        "macos": {
          "anyOf": [
            {
              "$ref": "#/definitions/HookOverride"
            },
            {
              "type": "null"
            }
          ]
        },
        "stage": {
          "description": "The stage in the build process to execute this hook.",
          "allOf": [
            {
              "$ref": "#/definitions/PipelineStage"
            }
          ]
        },
        "windows": {
          "anyOf": [
            {
              "$ref": "#/definitions/HookOverride"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "HookOverride": {
      "description": "OS-specific overrides.",
      "type": "object",
      "required": [
        "command"
      ],
      "properties": {
        "command": {
          "description": "The command to run for this hook.",
          "type": "string"
        },
        "command_arguments": {
          "description": "Any arguments to pass to the command.",
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "Hooks": {
      "description": "Newtype for handling `Vec<Hook>`",
      "type": "array",
      "items": {
        "$ref": "#/definitions/Hook"
      }
    },
    "Minify": {
      "oneOf": [
        {
          "description": "Never minify",
          "type": "string",
          "enum": [
            "never"
          ]
        },
        {
          "description": "Minify for release builds",
          "type": "string",
          "enum": [
            "on_release"
          ]
        },
        {
          "description": "Minify for all builds",
          "type": "string",
          "enum": [
            "always"
          ]
        }
      ]
    },
    "PipelineStage": {
      "description": "A stage in the build process.\n\nThis is used to specify when a hook will run.",
      "oneOf": [
        {
          "description": "The stage before asset builds are executed.",
          "type": "string",
          "enum": [
            "pre_build"
          ]
        },
        {
          "description": "The stage where all asset builds are executed.",
          "type": "string",
          "enum": [
            "build"
          ]
        },
        {
          "description": "The stage after asset builds are executed.",
          "type": "string",
          "enum": [
            "post_build"
          ]
        }
      ]
    },
    "Proxies": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Proxy"
      }
    },
    "Proxy": {
      "description": "Config options for building proxies.",
      "type": "object",
      "required": [
        "backend"
      ],
      "properties": {
        "backend": {
          "description": "The URL of the backend to which requests are to be proxied.",
          "allOf": [
            {
              "$ref": "#/definitions/Uri"
            }
          ]
        },
        "insecure": {
          "description": "Configure the proxy to accept insecure certificates (danger!).",
          "default": false,
          "type": "boolean"
        },
        "no_redirect": {
          "description": "Automatically redirect proxy requests? `no_redirect` defaults to `false`, i.e. yes, follow redirects automatically.",
          "default": false,
          "type": "boolean"
        },
        "no_system_proxy": {
          "description": "Configure the proxy to bypass the system proxy.",
          "default": false,
          "type": "boolean"
        },
        "request_headers": {
          "description": "A set of headers to pass to the proxied backend.",
          "default": {},
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "rewrite": {
          "description": "An optional URI prefix which is to be used as the base URI for proxying requests, which defaults to the URI of the backend.\n\nWhen a value is specified, requests received on this URI will have this URI segment replaced with the URI of the `backend`.",
          "type": [
            "string",
            "null"
          ]
        },
        "ws": {
          "description": "Configure the proxy for handling WebSockets.",
          "default": false,
          "type": "boolean"
        }
      }
    },
    "Serve": {
      "description": "Config options for the serve system.",
      "type": "object",
      "properties": {
        "address": {
          "description": "A single address to serve on.",
          "default": null,
          "deprecated": true,
          "type": [
            "string",
            "null"
          ],
          "format": "ip"
        },
        "addresses": {
          "description": "The addresses to serve on [default: <local loopback>]",
          "default": [],
          "type": "array",
          "items": {
            "type": "string",
            "format": "ip"
          }
        },
        "aliases": {
          "description": "The aliases to serve on.",
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "csp": {
          "description": "The CSP;  {{NONE}} is replaced by a random nonce",
          "default": [
            "script-src 'wasm-unsafe-eval' 'nonce-{{NONCE}}'",
            "style-src 'nonce-{{NONCE}}'"
          ],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "disable_address_lookup": {
          "description": "Disable the reverse DNS lookup during startup",
          "default": false,
          "type": "boolean"
        },
        "disable_csp": {
          "description": "Disable CSP header",
          "default": false,
          "type": "boolean"
        },
        "headers": {
          "description": "Additional headers to send in responses",
          "default": {},
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "no_autoreload": {
          "description": "Disable auto-reload of the web app",
          "default": false,
          "type": "boolean"
        },
        "no_error_reporting": {
          "description": "Disable error reporting in the browser",
          "default": false,
          "type": "boolean"
        },
        "no_spa": {
          "description": "Disable fallback to index.html for missing files",
          "default": false,
          "type": "boolean"
        },
        "open": {
          "description": "Open a browser tab once the initial build is complete [default: false]",
          "default": false,
          "type": "boolean"
        },
        "port": {
          "description": "The port to serve on [default: 8080]",
          "default": 8080,
          "type": "integer",
          "format": "uint16",
          "minimum": 0.0
        },
        "prefer_address_family": {
          "anyOf": [
            {
              "$ref": "#/definitions/AddressFamily"
            },
            {
              "type": "null"
            }
          ]
        },
        "proxy_backend": {
          "description": "A URL to which requests will be proxied [default: None]",
          "deprecated": true,
          "anyOf": [
            {
              "$ref": "#/definitions/Uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "proxy_insecure": {
          "description": "Configure the proxy to accept insecure requests",
          "default": null,
          "deprecated": true,
          "type": [
            "boolean",
            "null"
          ]
        },
        "proxy_no_redirect": {
          "description": "Configure the proxy to not follow redirects",
          "default": null,
          "type": [
            "boolean",
            "null"
          ]
        },
        "proxy_no_system_proxy": {
          "description": "Configure the proxy to bypass system proxy",
          "default": null,
          "deprecated": true,
          "type": [
            "boolean",
            "null"
          ]
        },
        "proxy_rewrite": {
          "description": "The URI on which to accept requests which are to be rewritten and proxied to backend [default: None]",
          "default": null,
          "deprecated": true,
          "type": [
            "string",
            "null"
          ]
        },
        "proxy_ws": {
          "description": "Configure the proxy for handling WebSockets",
          "default": null,
          "deprecated": true,
          "type": [
            "boolean",
            "null"
          ]
        },
        "serve_base": {
          "description": "A base path to serve the application from",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "tls_cert_path": {
          "description": "The TLS cert file to enable TLS encryption",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "tls_key_path": {
          "description": "The TLS key file to enable TLS encryption",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "ws_base": {
          "description": "The path to the trunk web-socket",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "ws_protocol": {
          "description": "Protocol used for the auto-reload WebSockets connection",
          "anyOf": [
            {
              "$ref": "#/definitions/WsProtocol"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Tools": {
      "description": "Config options for automatic application downloads.",
      "type": "object",
      "properties": {
        "sass": {
          "description": "Version of `dart-sass` to use.",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "tailwindcss": {
          "description": "Version of `tailwindcss-cli` to use.",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "wasm_bindgen": {
          "description": "Version of `wasm-bindgen` to use.",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "wasm_opt": {
          "description": "Version of `wasm-opt` to use.",
          "default": null,
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "Uri": {
      "type": "string",
      "format": "uri"
    },
    "VersionReq": {
      "type": "string"
    },
    "Watch": {
      "description": "Config options for the watch system.",
      "type": "object",
      "properties": {
        "ignore": {
          "description": "Paths to ignore [default: []]",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "watch": {
          "description": "Watch specific file(s) or folder(s) [default: build target parent folder]",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "WsProtocol": {
      "description": "WebSocket protocol",
      "type": "string",
      "enum": [
        "wss",
        "ws"
      ]
    }
  }
}