Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-01-02 Thread Yadd
Package: node-terser
Version: 4.1.2-9
Severity: important
Tags: patch

Hi,

node-commander 8 changed option parsing. Here is a proposed patch to be
used in replacement of 1001_use_commander_4.patch
Description: support node module commander release 8
 same patch than uglifyjs
Author: Yadd 
Forwarded: no
Last-Update: 2022-01-03

--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -28,6 +28,15 @@
 program.version(info.name + " " + info.version);
 program.parseArgv = program.parse;
 program.parse = undefined;
+var argv = [];
+process.argv.forEach(function(arg){
+  if(arg.match(/^-([pcmbode]+)$/)) {
+argv = argv.concat(RegExp.$1.split('').map(s => { return '-'+s }));
+  }
+  else argv.push(arg);
+});
+process.argv = argv;
+
 if (process.argv.includes("ast")) program.helpInformation = describe_ast;
 else if (process.argv.includes("options")) program.helpInformation = 
function() {
 var text = [];
@@ -65,10 +74,11 @@
 program.option("--warn", "Print warning messages.");
 program.option("--wrap ", "Embed everything as a function with “exports” 
corresponding to “name” globally.");
 program.arguments("[files...]").parseArgv(process.argv);
-if (program.configFile) {
-options = JSON.parse(read_file(program.configFile));
+const opts = program.opts();
+if (opts.configFile) {
+options = JSON.parse(read_file(opts.configFile));
 }
-if (!program.output && program.sourceMap && program.sourceMap.url != "inline") 
{
+if (!opts.output && opts.sourceMap && opts.sourceMap.url != "inline") {
 fatal("ERROR: cannot write source map to STDOUT");
 }
 [
@@ -82,83 +92,83 @@
 "toplevel",
 "wrap"
 ].forEach(function(name) {
-if (name in program) {
-options[name] = program[name];
+if (name in opts) {
+options[name] = opts[name];
 }
 });
-if ("ecma" in program) {
-if (program.ecma != (program.ecma | 0)) fatal("ERROR: ecma must be an 
integer");
-options.ecma = program.ecma | 0;
+if ("ecma" in opts) {
+if (opts.ecma != (opts.ecma | 0)) fatal("ERROR: ecma must be an integer");
+options.ecma = opts.ecma | 0;
 }
-if (program.beautify) {
-options.output = typeof program.beautify == "object" ? program.beautify : 
{};
+if (opts.beautify) {
+options.output = typeof opts.beautify == "object" ? opts.beautify : {};
 if (!("beautify" in options.output)) {
 options.output.beautify = true;
 }
 }
-if (program.comments) {
+if (opts.comments) {
 if (typeof options.output != "object") options.output = {};
-options.output.comments = typeof program.comments == "string" ? 
program.comments : "some";
+options.output.comments = typeof opts.comments == "string" ? opts.comments 
: "some";
 }
-if (program.define) {
+if (opts.define) {
 if (typeof options.compress != "object") options.compress = {};
 if (typeof options.compress.global_defs != "object") 
options.compress.global_defs = {};
-for (var expr in program.define) {
-options.compress.global_defs[expr] = program.define[expr];
+for (var expr in opts.define) {
+options.compress.global_defs[expr] = opts.define[expr];
 }
 }
-if (program.keepClassnames) {
+if (opts.keepClassnames) {
 options.keep_classnames = true;
 }
-if (program.keepFnames) {
+if (opts.keepFnames) {
 options.keep_fnames = true;
 }
-if (program.mangleProps) {
-if (program.mangleProps.domprops) {
-delete program.mangleProps.domprops;
+if (opts.mangleProps) {
+if (opts.mangleProps.domprops) {
+delete opts.mangleProps.domprops;
 } else {
-if (typeof program.mangleProps != "object") program.mangleProps = {};
-if (!Array.isArray(program.mangleProps.reserved)) 
program.mangleProps.reserved = [];
+if (typeof opts.mangleProps != "object") opts.mangleProps = {};
+if (!Array.isArray(opts.mangleProps.reserved)) 
opts.mangleProps.reserved = [];
 }
 if (typeof options.mangle != "object") options.mangle = {};
-options.mangle.properties = program.mangleProps;
+options.mangle.properties = opts.mangleProps;
 }
-if (program.nameCache) {
-options.nameCache = JSON.parse(read_file(program.nameCache, "{}"));
+if (opts.nameCache) {
+options.nameCache = JSON.parse(read_file(opts.nameCache, "{}"));
 }
-if (program.output == "ast") {
+if (opts.output == "ast") {
 options.output = {
 ast: true,
 code: false
 };
 }
-if (program.parse) {
-if (!program.parse.acorn && !program.parse.spidermonkey) {
-options.parse = program.parse;
-} else if (program.sourceMap && program.sourceMap.content == "inline") {
+if (opts.parse) {
+if (!opts.parse.acorn && !opts.parse.spidermonkey) {
+options.parse = opts.parse;
+} else if (opts.sourceMap && opts.sourceMap.content == "inline") {
 fatal("ERROR: inline source map only works with built-in parser");
 }
 }
 if (~program.rawArgs.indexOf("--rename")) {
 options.rename = true;
-} else if (!program.rename) {
+} else if (!opts.rename) {
 options.renam

Bug#1003039: [Pkg-javascript-devel] Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Jonas Smedegaard
Hi Yadd,

Quoting Yadd (2022-01-03 08:08:31)
> node-commander 8 changed option parsing. Here is a proposed patch to 
> be used in replacement of 1001_use_commander_4.patch

Thanks for the patch!

If I understand correctly, the patch is not backwards-compatible with 
node-commander currently in Debian unstable/testing.  I will therefore 
do nothing until node-commander enters unstable.

If I am mistaken, or am missing other options, then please help 
enlighten me. :-)

Btw, sorry for wrongly including this unrelated bugreport in a request 
for help upgrading terser.

Regards,

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature


Bug#1003039: [Pkg-javascript-devel] Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Yadd

On 06/02/2022 12:35, Jonas Smedegaard wrote:

Hi Yadd,

Quoting Yadd (2022-01-03 08:08:31)

node-commander 8 changed option parsing. Here is a proposed patch to
be used in replacement of 1001_use_commander_4.patch


Thanks for the patch!

If I understand correctly, the patch is not backwards-compatible with
node-commander currently in Debian unstable/testing.  I will therefore
do nothing until node-commander enters unstable.


Hi,

Thanks to look at this. Yes, we have to coordinate this because I have 
to add a 'Breaks: node-terser (<< XXX)'


I think the same patch should be applied to uglifyjs


If I am mistaken, or am missing other options, then please help
enlighten me. :-)

Btw, sorry for wrongly including this unrelated bugreport in a request
for help upgrading terser.


Best regards,
Yadd



Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Jonas Smedegaard
Quoting Yadd (2022-02-06 13:18:10)
> On 06/02/2022 12:35, Jonas Smedegaard wrote:
> > Quoting Yadd (2022-01-03 08:08:31)
> >> node-commander 8 changed option parsing. Here is a proposed patch 
> >> to be used in replacement of 1001_use_commander_4.patch
> > 
> > Thanks for the patch!
> > 
> > If I understand correctly, the patch is not backwards-compatible 
> > with node-commander currently in Debian unstable/testing.  I will 
> > therefore do nothing until node-commander enters unstable.

> Thanks to look at this. Yes, we have to coordinate this because I have 
> to add a 'Breaks: node-terser (<< XXX)'

Only coordination needed is, I think, is to bump severity of this 
bugreport when new node-commander enters unstable.


> I think the same patch should be applied to uglifyjs

node-uglifyjs stopped using node-commander since release 3.10.1-1, so it 
seems to me that no new Breaks is needed compared to the one in 
node-commander 6.2.1-2, and that even that can be dropped when buster 
stops being supported.

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature


Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Yadd

On 06/02/2022 13:36, Jonas Smedegaard wrote:

Quoting Yadd (2022-02-06 13:18:10)

On 06/02/2022 12:35, Jonas Smedegaard wrote:

Quoting Yadd (2022-01-03 08:08:31)

node-commander 8 changed option parsing. Here is a proposed patch
to be used in replacement of 1001_use_commander_4.patch


Thanks for the patch!

If I understand correctly, the patch is not backwards-compatible
with node-commander currently in Debian unstable/testing.  I will
therefore do nothing until node-commander enters unstable.



Thanks to look at this. Yes, we have to coordinate this because I have
to add a 'Breaks: node-terser (<< XXX)'


Only coordination needed is, I think, is to bump severity of this
bugreport when new node-commander enters unstable.



I think the same patch should be applied to uglifyjs


node-uglifyjs stopped using node-commander since release 3.10.1-1, so it
seems to me that no new Breaks is needed compared to the one in
node-commander 6.2.1-2, and that even that can be dropped when buster
stops being supported.

  - Jonas


OK, for now node-commander breaks yarnpkg < 1.22.10+~cs22.25.14-6~ and 
cleancss < 5.2.2+~5.5.0~. I'm ready to push these 3 packages. Do I have 
to add "terser (<< 4.1.2-9~)" ?




Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Jonas Smedegaard
Quoting Yadd (2022-02-06 14:24:02)
> On 06/02/2022 13:36, Jonas Smedegaard wrote:
> > Quoting Yadd (2022-02-06 13:18:10)
> >> On 06/02/2022 12:35, Jonas Smedegaard wrote:
> >>> Quoting Yadd (2022-01-03 08:08:31)
>  node-commander 8 changed option parsing. Here is a proposed patch 
>  to be used in replacement of 1001_use_commander_4.patch
> >>>
> >>> Thanks for the patch!
> >>>
> >>> If I understand correctly, the patch is not backwards-compatible 
> >>> with node-commander currently in Debian unstable/testing.  I will 
> >>> therefore do nothing until node-commander enters unstable.
> > 
> >> Thanks to look at this. Yes, we have to coordinate this because I 
> >> have to add a 'Breaks: node-terser (<< XXX)'
> > 
> > Only coordination needed is, I think, is to bump severity of this 
> > bugreport when new node-commander enters unstable.
> > 
> > 
> >> I think the same patch should be applied to uglifyjs
> > 
> > node-uglifyjs stopped using node-commander since release 3.10.1-1, 
> > so it seems to me that no new Breaks is needed compared to the one 
> > in node-commander 6.2.1-2, and that even that can be dropped when 
> > buster stops being supported.
> > 
> >   - Jonas
> 
> OK, for now node-commander breaks yarnpkg < 1.22.10+~cs22.25.14-6~ and 
> cleancss < 5.2.2+~5.5.0~. I'm ready to push these 3 packages. Do I 
> have to add "terser (<< 4.1.2-9~)" ?

I think this is better: "Breaks: uglifyjs.terser (<= 4.1.2-9+)"

That rejects current unsupported terser in unstable, and also potential 
well-versioned derivatives, but not the next one.

It fails to reject current unsupported _experimental_ package, but you 
should not care about experimental when targeting unstable.

When you have released, then I will release package with patch applied, 
to unstable and also to experimental.

Makes sense, or do you suspect I missed something?


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature


Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Yadd

On 06/02/2022 14:51, Jonas Smedegaard wrote:

Quoting Yadd (2022-02-06 14:24:02)

On 06/02/2022 13:36, Jonas Smedegaard wrote:

Quoting Yadd (2022-02-06 13:18:10)

On 06/02/2022 12:35, Jonas Smedegaard wrote:

Quoting Yadd (2022-01-03 08:08:31)

node-commander 8 changed option parsing. Here is a proposed patch
to be used in replacement of 1001_use_commander_4.patch


Thanks for the patch!

If I understand correctly, the patch is not backwards-compatible
with node-commander currently in Debian unstable/testing.  I will
therefore do nothing until node-commander enters unstable.



Thanks to look at this. Yes, we have to coordinate this because I
have to add a 'Breaks: node-terser (<< XXX)'


Only coordination needed is, I think, is to bump severity of this
bugreport when new node-commander enters unstable.



I think the same patch should be applied to uglifyjs


node-uglifyjs stopped using node-commander since release 3.10.1-1,
so it seems to me that no new Breaks is needed compared to the one
in node-commander 6.2.1-2, and that even that can be dropped when
buster stops being supported.

   - Jonas


OK, for now node-commander breaks yarnpkg < 1.22.10+~cs22.25.14-6~ and
cleancss < 5.2.2+~5.5.0~. I'm ready to push these 3 packages. Do I
have to add "terser (<< 4.1.2-9~)" ?


I think this is better: "Breaks: uglifyjs.terser (<= 4.1.2-9+)"


This forbid 4.1.2-9 which doesn't exist yet, isn't it ?



Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Jonas Smedegaard
Quoting Yadd (2022-02-06 14:55:28)
> On 06/02/2022 14:51, Jonas Smedegaard wrote:
> > Quoting Yadd (2022-02-06 14:24:02)
> >> On 06/02/2022 13:36, Jonas Smedegaard wrote:
> >>> Quoting Yadd (2022-02-06 13:18:10)
>  On 06/02/2022 12:35, Jonas Smedegaard wrote:
> > Quoting Yadd (2022-01-03 08:08:31)
> >> node-commander 8 changed option parsing. Here is a proposed patch
> >> to be used in replacement of 1001_use_commander_4.patch
> >
> > Thanks for the patch!
> >
> > If I understand correctly, the patch is not backwards-compatible
> > with node-commander currently in Debian unstable/testing.  I will
> > therefore do nothing until node-commander enters unstable.
> >>>
>  Thanks to look at this. Yes, we have to coordinate this because I
>  have to add a 'Breaks: node-terser (<< XXX)'
> >>>
> >>> Only coordination needed is, I think, is to bump severity of this
> >>> bugreport when new node-commander enters unstable.
> >>>
> >>>
>  I think the same patch should be applied to uglifyjs
> >>>
> >>> node-uglifyjs stopped using node-commander since release 3.10.1-1,
> >>> so it seems to me that no new Breaks is needed compared to the one
> >>> in node-commander 6.2.1-2, and that even that can be dropped when
> >>> buster stops being supported.
> >>>
> >>>- Jonas
> >>
> >> OK, for now node-commander breaks yarnpkg < 1.22.10+~cs22.25.14-6~ and
> >> cleancss < 5.2.2+~5.5.0~. I'm ready to push these 3 packages. Do I
> >> have to add "terser (<< 4.1.2-9~)" ?
> > 
> > I think this is better: "Breaks: uglifyjs.terser (<= 4.1.2-9+)"
> 
> This forbid 4.1.2-9 which doesn't exist yet, isn't it ?

According to https://tracker.debian.org/pkg/node-terser I successfully 
released uglifyjs.terser 4.1.2-9 2021-11-05.

...but I think you are right that ~ is more correct, so use this:

  Breaks: uglifyjs.terser (<< 4.1.2-10~)


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature


Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Yadd

On 06/02/2022 17:01, Jonas Smedegaard wrote:

Quoting Yadd (2022-02-06 13:18:10)

On 06/02/2022 12:35, Jonas Smedegaard wrote:

Quoting Yadd (2022-01-03 08:08:31)

node-commander 8 changed option parsing. Here is a proposed patch
to be used in replacement of 1001_use_commander_4.patch


Thanks for the patch!

If I understand correctly, the patch is not backwards-compatible
with node-commander currently in Debian unstable/testing.  I will
therefore do nothing until node-commander enters unstable.



Thanks to look at this. Yes, we have to coordinate this because I have
to add a 'Breaks: node-terser (<< XXX)'


Could you please clarify: Which range of node-commander releases should
the proposed patch support?


AFAIK, it is for commander >= 7



Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Jonas Smedegaard
Quoting Yadd (2022-02-06 13:18:10)
> On 06/02/2022 12:35, Jonas Smedegaard wrote:
> > Quoting Yadd (2022-01-03 08:08:31)
> >> node-commander 8 changed option parsing. Here is a proposed patch 
> >> to be used in replacement of 1001_use_commander_4.patch
> > 
> > Thanks for the patch!
> > 
> > If I understand correctly, the patch is not backwards-compatible 
> > with node-commander currently in Debian unstable/testing.  I will 
> > therefore do nothing until node-commander enters unstable.

> Thanks to look at this. Yes, we have to coordinate this because I have 
> to add a 'Breaks: node-terser (<< XXX)'

Could you please clarify: Which range of node-commander releases should 
the proposed patch support?

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature


Bug#1003039: [Pkg-javascript-devel] Bug#1003039: Bug#1003039: node-terser: Please update node-commander dependency to version 8

2022-02-06 Thread Jonas Smedegaard
Quoting Yadd (2022-02-06 17:02:08)
> On 06/02/2022 17:01, Jonas Smedegaard wrote:
> > Quoting Yadd (2022-02-06 13:18:10)
> >> On 06/02/2022 12:35, Jonas Smedegaard wrote:
> >>> Quoting Yadd (2022-01-03 08:08:31)
>  node-commander 8 changed option parsing. Here is a proposed patch 
>  to be used in replacement of 1001_use_commander_4.patch
> >>>
> >>> Thanks for the patch!
> >>>
> >>> If I understand correctly, the patch is not backwards-compatible 
> >>> with node-commander currently in Debian unstable/testing.  I will 
> >>> therefore do nothing until node-commander enters unstable.
> > 
> >> Thanks to look at this. Yes, we have to coordinate this because I 
> >> have to add a 'Breaks: node-terser (<< XXX)'
> > 
> > Could you please clarify: Which range of node-commander releases 
> > should the proposed patch support?
> 
> AFAIK, it is for commander >= 7

Thanks for clarifying - much appreciated.

For future sake, the long description indented lines in DEP-3 patch 
header is an excellent place to mention such details about the scope of 
the patch - and it is less helpful to write "same patch than uglifyjs" 
there, because such note require external knowledge: uglifyjs module? 
uglifyjs rpm package? which version? same how?

I.e. DEP-3 headers should be equally sensible to other distros and to 
upstream - notes specific to a distro should explicitly state that (e.g. 
using Bug-Debian: hint).

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature