Closed granicz closed 10 months ago
@granicz I don't like 3a. (If it's any of "off"/"dll"/"none"/"" - don't output JS files.) Why just not set/null? why magic aliases?
A concrete value and null
would be a valid value set for an option setting (None or Some of x), but the current setting name (JsOutput
) refers to the JS output without a "nothing/null" case ("and place that into the DLL and potentially in files too") and not the optionality of the file system location. We could go with what you suggest if the setting was called "JsOutputPath"
, but as it is, I'd prefer to go with the original 3a clause.
After further discussion we ended up with just using null/not setting the JsOutput
property in wsconfig
to indicate that we don't want to write .js
/.jsx
files for the library project.
The compiler/configuration setting
"JsOutput" : "path"
has been used to write out the "assembly-wide" JavaScript output into the file system (in addition to being stored in the DLL) up until WebSharper 6. However, this format is now changing with WebSharper 7 to take advantage of EcmaScript modules, as documented in #1318 .This ticket is for the work involved to update
JsOutput
configurability to WebSharper 7.The proposal is as follows:
Output is written in a one-file-per-type (OFPT) format into files
"assembly/typename.js"
, whereassembly
is the assembly name without the extension (such asWebSharper.UI
), andtypename
is the full name of a type (module, class, or other type, such asWebSharper.UI.Var
). Nested modules (F#) / classes (C#) produce output files for each non-empty module/class.If
JsOutput
is specified and refers to a folder (relative or absolute, ending with/
), it's used as a prefix to the output files' location.If
JsOutput
is specified and refers to a file (ends with a file extension such as.js
), an error is raised ("JavaScript file output is not implemented") - this might be revisited later on a subsequent ticket to enable "bundled" output.For any other value of
JsOutput
, do as follows: a. If it's any of"off"
/"dll"
/"none"
/""
- don't output JS files. b. For everything else, yield a compiler warning ("Invalid value for JsOutput, assuming "none""
), and assume it was"none"
.If
JsOutput
is not specified, no JS output files are written.The JS output structure as defined in Part 0 above should be stored in the DLL as embedded resources, regardless of the choice of
JsOutput
.And finally, to make it easier to access this feature, add
"JsOutput" : "none"
towsconfig.json
in the Library project templates (C# and F#) - and link the ticket for it here.