You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Proxy Access To Remote Includes](#proxy-access-to-remote-includes)
57
+
-[Local Includes From Remote Files](#local-includes-from-remote-files)
57
58
-[Testing](#testing)
58
59
-[License](#license)
59
60
@@ -458,15 +459,15 @@ The following types are supported in expressions:
458
459
Variables can be used in `Builder` expression evaluation.
459
460
460
461
- Variables can be defined by:
461
-
- The `-D<variable name> <variable value>` command line parameter.
462
+
- The `-D<variable name> <variable value>` command line parameter.
462
463
- A <code><b>@set</b></code> statement.
463
464
- An [environment variable](#environment-variables).
464
465
- Undefined variables are evaluated as `null`.
465
466
- Variable names can contain `$`, `_`, latin letters and digits. They must not start with a digit.
466
467
467
468
#### Variable Definition Order ####
468
469
469
-
1. When resolving a variable’s value, *Builder* first looks for its definition in the command line `-D` parameters (`-D<variable name> <variable value>`) passed to the *pleasebuild* command.
470
+
1. When resolving a variable’s value, *Builder* first looks for its definition in the command line `-D` parameters (`-D<variable name> <variable value>`) passed to the *pleasebuild* command.
470
471
1. If no such variable definition is found, Squirrel code is scanned for `@set` statements preceding the variable usage.
471
472
1. If no variable definitions are found in the previous steps, *Builder* looks in the host environment variables.
472
473
@@ -592,9 +593,10 @@ npm install -g Builder
592
593
then use the `pleasebuild` command which is provided by Builder:
| -l || No | No | Generates line control statements. For a more detailed explanation, please read [this GCC page](https://gcc.gnu.org/onlinedocs/gcc-4.5.4/cpp/Line-Control.html)|
613
-
| -D<variable>|| No | Yes | Defines a [variable](#variables). May be specified several times to define multiple variables |
615
+
| -D<variable>|| No | Yes | Defines a [variable](#variables). May be specified several times to define multiple variables |
614
616
| --github-user || No | Yes | A GitHub username. See [‘Files From GitHub’](#files-from-github)|
615
617
| --github-token || No | Yes | A GitHub [personal access token](https://github.com/settings/tokens) or password (not recommended). Should be specified if the `--github-user` option is specified. See [‘Files From GitHub’](#files-from-github)|
616
618
| --lib | --libs | No | Yes | Include the specified [JavaScript file(s) as a library](#including-javascript-libraries). May be specified several times to include multiple libraries. The provided value may specify a concrete file or a directory (all files from the directory will be included). The value may contain [wildcards](https://www.npmjs.com/package/glob) (all matched files will be included) |
619
+
| --use-remote-relative-includes || No | No | Interpret every [local include](#local-files) as relative to the location of the source file where it is mentioned. See ['Local Includes From Remote Files'](#local-includes-from-remote-files)|
617
620
| --suppress-duplicate-includes-warning | --suppress-duplicate | No | No | Do not show a warning if a source file with the same content was included multiple times from different locations and this results in code duplication |
618
621
| --cache | -c | No | No | Turn on caching for all files included from remote resources. This option is ignored if the `--save-dependencies` or `--use-dependencies` options are specified. See [‘Caching Remote Includes’](#caching-remote-includes)|
619
622
| --clear-cache || No | No | Clear the cache before Builder starts running. See [‘Caching Remote Includes’](#caching-remote-includes)|
@@ -637,32 +640,36 @@ then instantiate, setup and execute Builder from the source code, for example:
637
640
constBuilder=require('Builder');
638
641
constbuilder=newBuilder();
639
642
640
-
// Specify whether you need line control statements. See the "-l" CLI option
643
+
// Specify whether you need line control statements. See the "-l" CLI option.
It is possible to save the build configuration used for preprocessing a source file — references to the concrete versions of GitHub files and libraries that are used, and to Builder variable definitions — and preprocess the source file again later with the saved configuration.
685
+
It is possible to save the build configuration used for preprocessing a source file — references to the concrete versions of GitHub files and libraries that are used, and Builder variable definitions which are used— and preprocess the source file again later with the saved configuration.
679
686
680
687
### GitHub Files: Dependencies ###
681
688
682
-
`--save-dependencies [<path_to_file>]` and `--use-dependencies [<path_to_file>]` options are used to save and to reuse, respectively, references to concrete versions of GitHub files and libraries. The references are saved in a JSON file. If a file is not specified, Builder will attempt to read a `dependencies.json` file from the local directory. Every reference consists of GitHub file URL and Git Blob ID (Git Blob SHA). For more information, please see [the Git Manual](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects) and [the GitA API](https://developer.github.com/v3/git/blobs/).
689
+
`--save-dependencies [<path_to_file>]` and `--use-dependencies [<path_to_file>]` options are used to save and to reuse, respectively, references to concrete versions of GitHub files and libraries. The references are saved in a JSON file. If a file name is not specified, the `dependencies.json` file in the local directory is used. Every reference consists of GitHub file URL and Git Blob ID (Git Blob SHA). For more information, please see [the Git Manual](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects) and [the Git API](https://developer.github.com/v3/git/blobs/).
683
690
684
691
**Note** It is possible to obtain the Git Blob ID of a GitHub file using the following *git* command: `git hash-object <path_to_file>`
685
692
@@ -695,14 +702,6 @@ These options are processed the following way:
695
702
696
703
**Note** If either `--save-dependencies` or `--use-dependencies` is specified, the `--cache` option is ignored.
697
704
698
-
### Builder Variables: Directives ###
699
-
700
-
The `--save-directives [<path_to_file>]` and `--use-directives [<path_to_file>]` options are used to, respectively, save and reuse Builder variable definitions. The definitions are saved in a JSON file. If a file is not specified, Builder will attempt to read a `directives.json` file from the local directory. These options are processed the similar way as the `--save-dependencies` and `--use-dependencies` options, above.
701
-
702
-
When the `--use-directives [<path_to_file>]` option is used, the saved Builder variable definitions are merged with definitions specified by `-D <variable> <value>` options.
703
-
704
-
### Example Files ###
705
-
706
705
A typical `dependencies.json` file looks like this:
707
706
708
707
```json
@@ -718,6 +717,12 @@ A typical `dependencies.json` file looks like this:
718
717
]
719
718
```
720
719
720
+
### Builder Variables: Directives ###
721
+
722
+
The `--save-directives [<path_to_file>]` and `--use-directives [<path_to_file>]` options are used to, respectively, save and reuse Builder variable definitions. The definitions are saved in a JSON file. If a file is not specified, the `directives.json` file in the local directory is used. These options are processed the similar way as the `--save-dependencies` and `--use-dependencies` options, above.
723
+
724
+
When the `--use-directives [<path_to_file>]` option is used, the saved Builder variable definitions are merged with definitions specified by `-D<variable> <value>` options.
725
+
721
726
A typical `directives.json` file looks like this:
722
727
723
728
```json
@@ -843,6 +848,16 @@ For example, to operate through a proxy running at IP address 192.168.10.2 on po
843
848
844
849
**Note** Files retrieved from GitHub (`github:` protocol) are always accessed using HTTPS. So when specifying a proxy in this case, make sure you use set the `HTTPS_PROXY` environment variable.
845
850
851
+
### Local Includes From Remote Files ###
852
+
853
+
By default, all [local includes](#local-files), even if they are mentioned in remote source files, are always interpreted as relative to the system where Builder is running.
854
+
855
+
If `--use-remote-relative-includes` option is specified, every [local include](#local-files) is interpreted as relative to the location of the source file where it is mentioned. For example, a local include mentioned in remote source file from GitHub will be downloaded from the same GitHub URL as the source file.
856
+
857
+
`--use-remote-relative-includes` option does not affect includes with [absolute remote paths](#remote-files).
858
+
859
+
**Note** In the current Builder version `--use-remote-relative-includes` option affects includes mentioned in remote source files from GitHub only.
\t\u001b[34m-l\u001b[39m - generates line control statements
72
-
\t\u001b[34m-D<varname> <value>\u001b[39m - define a variable that will be available from the source
73
-
\t\u001b[34m--github-user <username>\u001b[39m - username for GitHub
74
-
\t\u001b[34m--github-token <token>\u001b[39m - personal access token or password for GitHub
75
-
\t\u001b[34m--lib <path_to_file>\u001b[39m - includes the specified JavaScript file(s) as a library
76
-
\t\u001b[34m--suppress-duplicate-includes-warning\u001b[39m - does not show a warning if a source file with the exact content was included multiple times
77
-
\t\u001b[34m--cache>\u001b[39m - turns on cache for all files included from remote resources
78
-
\t\u001b[34m--clear-cache\u001b[39m - clears cache before Builder starts running
79
-
\t\u001b[34m--cache-exclude-list <path_to_file>\u001b[39m - path to the file that lists the resources which should be excluded from caching
80
-
\t\u001b[34m--save-dependencies [path_to_file]\u001b[39m - saves references to the used versions of GitHub files in the specified file
81
-
\t\u001b[34m--use-dependencies [path_to_file]\u001b[39m - reads from the specified file references to the versions of GitHub files which should be used
82
-
\t\u001b[34m--save-directives [path_to_file]\u001b[39m - saves Builder variable definitions in the specified file
83
-
\t\u001b[34m--use-directives [path_to_file]\u001b[39m - reads from the specified file Builder variable definitions which should be used
72
+
\t\u001b[34m-D<varname> <value>\u001b[39m - defines a variable
73
+
\t\u001b[34m--github-user <username>\u001b[39m - a GitHub username
74
+
\t\u001b[34m--github-token <token>\u001b[39m - a GitHub personal access token or password
75
+
\t\u001b[34m--lib <path_to_file>\u001b[39m - include the specified JavaScript file(s) as a library
76
+
\t\u001b[34m--use-remote-relative-includes\u001b[39m - interpret every local include as relative to the location of the source file where it is mentioned
77
+
\t\u001b[34m--suppress-duplicate-includes-warning\u001b[39m - do not show a warning if a source file with the same content was included multiple times
78
+
\t\u001b[34m--cache>\u001b[39m - turn on caching for all files included from remote resources
79
+
\t\u001b[34m--clear-cache\u001b[39m - clear the cache before Builder starts running
80
+
\t\u001b[34m--cache-exclude-list <path_to_file>\u001b[39m - set the path to the file that lists resources which should not be cached
81
+
\t\u001b[34m--save-dependencies [path_to_file]\u001b[39m - save references to the required GitHub files in the specified file
82
+
\t\u001b[34m--use-dependencies [path_to_file]\u001b[39m - use the specified file to set which GitHub files are required
83
+
\t\u001b[34m--save-directives [path_to_file]\u001b[39m - save Builder variable definitions in the specified file
84
+
\t\u001b[34m--use-directives [path_to_file]\u001b[39m - use Builder variable definitions from the specified file
84
85
\t\u001b[34m<input_file>\u001b[39m — is the path to source file which should be preprocessed
85
86
`.trim());
86
87
}
@@ -163,6 +164,8 @@ function readArgs() {
163
164
throwError('Expected argument value after '+argument);
0 commit comments