File tree 7 files changed +50
-6
lines changed
tests/specs/compile/include_folder
7 files changed +50
-6
lines changed Original file line number Diff line number Diff line change @@ -1909,10 +1909,10 @@ On the first invocation with deno will download the proper binary and cache it i
1909
1909
Arg :: new ( "include" )
1910
1910
. long ( "include" )
1911
1911
. help (
1912
- cstr ! ( "Includes an additional module or local data file in the compiled executable.
1912
+ cstr ! ( "Includes an additional module or file/directory in the compiled executable.
1913
1913
<p(245)>Use this flag if a dynamically imported module or a web worker main module
1914
- fails to load in the executable or to embed a file in the executable. This flag can
1915
- be passed multiple times, to include multiple additional modules.</>" ,
1914
+ fails to load in the executable or to embed a file or directory in the executable.
1915
+ This flag can be passed multiple times, to include multiple additional modules.</>" ,
1916
1916
) )
1917
1917
. action ( ArgAction :: Append )
1918
1918
. value_hint ( ValueHint :: FilePath )
Original file line number Diff line number Diff line change @@ -620,9 +620,17 @@ impl<'a> DenoCompileBinaryWriter<'a> {
620
620
} ;
621
621
for include_file in include_files {
622
622
let path = deno_path_util:: url_to_file_path ( include_file) ?;
623
- vfs
624
- . add_file_at_path ( & path)
625
- . with_context ( || format ! ( "Including {}" , path. display( ) ) ) ?;
623
+ if path. is_dir ( ) {
624
+ // TODO(#26941): we should analyze if any of these are
625
+ // modules in order to include their dependencies
626
+ vfs
627
+ . add_dir_recursive ( & path)
628
+ . with_context ( || format ! ( "Including {}" , path. display( ) ) ) ?;
629
+ } else {
630
+ vfs
631
+ . add_file_at_path ( & path)
632
+ . with_context ( || format ! ( "Including {}" , path. display( ) ) ) ?;
633
+ }
626
634
}
627
635
let mut remote_modules_store = RemoteModulesStoreBuilder :: default ( ) ;
628
636
let mut code_cache_key_hasher = if self . cli_options . code_cache_enabled ( ) {
Original file line number Diff line number Diff line change
1
+ {
2
+ "tempDir" : true ,
3
+ "steps" : [{
4
+ "if" : " unix" ,
5
+ "args" : " compile --allow-read=data --include data --output main main.js" ,
6
+ "output" : " [WILDCARD]"
7
+ }, {
8
+ "if" : " unix" ,
9
+ "commandName" : " ./main" ,
10
+ "args" : [],
11
+ "output" : " output.out" ,
12
+ "exitCode" : 0
13
+ }, {
14
+ "if" : " windows" ,
15
+ "args" : " compile --allow-read=data --include data --output main.exe main.js" ,
16
+ "output" : " [WILDCARD]"
17
+ }, {
18
+ "if" : " windows" ,
19
+ "commandName" : " ./main.exe" ,
20
+ "args" : [],
21
+ "output" : " output.out" ,
22
+ "exitCode" : 0
23
+ }]
24
+ }
Original file line number Diff line number Diff line change
1
+ a
Original file line number Diff line number Diff line change
1
+ b
Original file line number Diff line number Diff line change
1
+ const dataDir = import . meta. dirname + "/data" ;
2
+ const files = Array . from (
3
+ Deno . readDirSync ( dataDir ) . map ( ( entry ) => dataDir + "/" + entry . name ) ,
4
+ ) ;
5
+ files . sort ( ) ;
6
+ for ( const file of files ) {
7
+ console . log ( Deno . readTextFileSync ( file ) . trim ( ) ) ;
8
+ }
Original file line number Diff line number Diff line change
1
+ a
2
+ b
You can’t perform that action at this time.
0 commit comments