4 ms·
Client-side JavaScript is always distributed[1] source[2] code - because your web page is distributing it to the user's browser. So AFAIK you shouldn't use GPL
by robocat 2y ago
Client-side JavaScript is always distributed[1] source[2] code - because your web page is distributing it to the user's browser. So AFAIK you shouldn't use GPL nor LGPL code in your pages unless all your client-side JavaScript in the page is appropriately licenced. Minified or obfuscated is still source code (you must provide original source as per license).
Client-side LGPL JavaScript is neither statically linked nor dynamically linked but potentially could be a "mere aggregation" i.e. it is hard to use LGPL legally. Perhaps you could meet the legal definition of calling a library by using web assembly or web workers (see your IP lawyer!).
Unfortunately the FSF appear to be intentionally vague when documenting this issue.
For more details see:
https://greendrake.info/publications/js-gpl https://greendrake.info/publications/js-gpl
https://opensource.stackexchange.com/questions/4360/what-are-the-implications-of-licensing-a-javascript-library-under-gpl#4500 https://opensource.stackexchange.com/questions/4360/what-are... (be careful reading it because part of that answer is about what circumstances client-side GPL mean that the server-side should be GPLed).
This issue can affect the HTML and CSS too:
It is possible to write Javascript code which is strongly bound to a particular HTML document. The Javascript code in this case would have hard-coded references to parts of the HTML document and would rely on that document's particular structure to work. This would be a strong indication that the Javascript and the document should be considered a single work.
Edit: [1] Well conveyed: https://www.gnu.org/licenses/gpl-faq.html#ConveyVsDistribute https://www.gnu.org/licenses/gpl-faq.html#ConveyVsDistribute
Edit: [2] or object code (transpiled/minified) but distributing/conveying object code usually requires you to provde source.
- gtsop 2y agoAll code ran by users is distributed source code. Not sure what is the distinction you are mentioning > Unfortunately the FSF appear to be intentionally vague when documenting this issue. This is only unfortunate when you don't allign with their purpose, in which case there is no reason to talk of using GPL at all. For people who allign with these purposes, this "vagueness" is fortunate
- d1sxeyes 2y agoThat's not true for code which gets pre-compiled. For interpreted (or JIT-compiled) code, then yes, by definition, the source needs to be distributed to end users in order to be executed. For compiled code, only the resultant binary needs to be shared after compiling the source.
- aprilnya 2y ago> Minified or obfuscated is still source code What about if my source code is in TypeScript and gets transpiled + bundled + minified into JS? Is that still source code?
- robocat 2y ago> transpiled + bundled + minified That is object code (I wrote source code incorrectly). But if the object code is part of a work then you may need to provide your "Corresponding Source" TypeScript code plus build files plus sometimes compiler tools. See my other comment https://news.ycombinator.com/item?id=40340774 https://news.ycombinator.com/item?id=40340774 The GPL and FSF are difficult to comply with depending on your situation. Also depends on your jurisdiction and the jurisdiction of the client using the browser (amongst other complexities).
- chrismorgan 2y ago> Client-side JavaScript is always distributed source code - because your web page is distributing it to the user's browser. […] Minified or obfuscated is still source code (you must provide original source as per license). Minified or obfuscated is certainly not source code under GPLv3’s definition <https://www.gnu.org/licenses/gpl-3.0.html#section1 https://www.gnu.org/licenses/gpl-3.0.html#section1>: > The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. The transformation very obviously makes it be considered object code.
- robocat 2y agoYes. Transformed/minified/obfuscated is object code. And when you convey object code then you need to provide the "corresponding source" as per section 6. But my comment is more about: how much of a web page is a "work based on the Program" or "modified version" when you distribute/convey GPL licensed JavaScript as part of your page? Abridged excerpts from: https://www.gnu.org/licenses/gpl-3.0.html#license-text https://www.gnu.org/licenses/gpl-3.0.html#license-text “The Program” refers to any copyrightable work licensed under this License. A “covered work” means either the unmodified Program or a work based on the Program. Propagation includes copying, distribution (with or without modification), making available to the public To “convey” a work means any kind of propagation that enables other parties to make or receive copies The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. 6. Conveying Non-Source Forms. You may convey a covered work in object code form [snip] provided that you also convey the machine-readable Corresponding Source under the terms of this License ... This is not legal advice. The FSF appears to be deliberately unclear about how GPL and JavaScript interact. And LibreJS is fairly useless to help you legally decide if your web page is a derived/modified work or not.
- justinclift 2y ago> The transformation very obviously makes it be considered object code. Congratulations, you've been shipping the built objects and need to provide the source now too for license compliance. ;)