Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#988507: update node-terser to alteast version 4.8

87 views
Skip to first unread message

Pirate Praveen

unread,
May 14, 2021, 8:00:03 AM5/14/21
to
Package: node-terser
Version: 4.1.2-8
Severity: wishlist
Control: block 988506 by -1

terser-webpack-plugin needs terser at least version 4.8. Is there any
known blockers I can help with?

Jonas Smedegaard

unread,
May 14, 2021, 8:30:03 AM5/14/21
to
Quoting Pirate Praveen (2021-05-14 13:46:28)
> terser-webpack-plugin needs terser at least version 4.8. Is there any
> known blockers I can help with?

Thanks for asking.

Draft package in git fails like this:

cd dist && ../bin/terser \
--mangle --compress \
--source-map 'content=bundle.js.map,includeSources=true' \
--output bundle.min.js \
-- bundle.js
Parse error at undefined:undefined,undefined

/build/node-terser-4.8.0/bin/terser:244
var lines = files[ex.filename].split(/\r?\n/);
^
TypeError: Cannot read property 'split' of undefined
at run (/build/node-terser-4.8.0/bin/terser:244:44)
at Object.<anonymous> (/build/node-terser-4.8.0/bin/terser:188:5)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47

/build/node-terser-4.8.0/tools/exit.js:14
throw exit;
^
[Function: exit]


I suspect it is related to patch 1001 to use commander 4 - would sure be
helpful to have a pair of fresh eyes on it.


- 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

Yadd

unread,
May 14, 2021, 11:10:03 PM5/14/21
to
Hi,

same error with and without 1001 patch

Yadd

unread,
May 14, 2021, 11:30:03 PM5/14/21
to
I tried this and get the same error:

$ cd /tmp
$ npm i ter...@4.8.0
$ cd -
$ cd dist && /tmp/node_modules/terser/bin/terser \
--mangle --compress \
--source-map 'content=bundle.js.map,includeSources=true' \
--output bundle.min.js \
-- bundle.js

Looking more, error seems to be in `rollup --no-esModule -c`: the
produced files looks strange (a mix of js and map)

Yadd

unread,
May 14, 2021, 11:30:03 PM5/14/21
to
No bundle.js it's a valid minified file

Jonas Smedegaard

unread,
Jun 13, 2021, 5:50:03 PM6/13/21
to
Hi Sunny,

Quoting Sonnie Nkwuda (2021-06-13 20:17:18)
> Hi there.
> I realized a step in the build was executing the terser mangle and compress commands against the build output ( bundle.min.js ) . I considered we don't need this step as we don't have to be executing the library against itself, so I made a change in debian/rules that seems to fix #988507. With this fix, the build works fine as it should and all the necessary binaries generated.
> Please find it at:  https://salsa.debian.org/sonnie/node-terser/-/commit/e380c31cf6c323807860d4caf439b8c954cb1d72Kindly review this fix so I can proceed with fix for #988508 which we need for #980316 .

Yes! Thanks a lot - that was indeed the problem.
signature.asc

Pirate Praveen

unread,
Jun 2, 2022, 12:10:04 PM6/2/22
to
On Sun, 06 Feb 2022 12:26:08 +0100 Jonas Smedegaard <d...@jones.dk> wrote:
> One known blocker for upgrading terser is that the executable has
> changed name. I should have adjusted all packages in the Javascript
> team and filed bugreports against packages outside the team, and now
in
> theory all packages should succesfully build with terser v4.8
available
> in experimental.
>
> Next step in upgrading terser to v4.8 is to test if that theory holds
> true. I have not found time for testing that for some time, and also
> don't have the experience in that task so I guess others in the team
are
> more efficient in doing it than me.
>
> So consider this an invitation to help modernizing terser package:
>
> 1. Test-build all reverse-build-dependencies of terser
> in a build environment with experimental terser 4.8.0-1
installed
> 2a. if many builds fail, report that to 988...@bugs.debian.org
> 2b. if few builds fail, file bugreport against those packages
> 3. report summary of tests made to 988...@bugs.debian.org

Ruby team has automated scripts for doing this.
https://salsa.debian.org/ruby-team/meta

setup script creates chroots for sbuild and lxc and then build script
prompts if we should test (rebuild using sbuild and autopkgtest using
lxc or schroot) any reverse (build) dependencies. We can choose the
list of packages to test and it will give a report after testing all
the selected packages.

I have been using this for all major updates (for ruby as well as js
packages) and I highly recommend using these scripts. I think Jeremy
also has something similar using gitlab ci, created for nodejs
rebuilds. We will have to provide a custom gitlab runner machine for
that I think (as salsa ci default runners don't support such mass
rebuilds).

While running this I noticed this autopkgtest error (fails also on
ci.debian.net). This probably needs an autopkgtest dependency on nodejs.

autopkgtest [15:56:55]: test command1: node -e "require('terser');"
autopkgtest [15:56:55]: test command1: [-----------------------
bash: line 1: node: command not found
autopkgtest [15:56:55]: test command1: -----------------------]
command1 FAIL non-zero exit status 127
autopkgtest [15:56:56]: test command1: - - - - - - - - - - results - -
- - - - - - - -
autopkgtest [15:56:56]: test command1: - - - - - - - - - - stderr - - -
- - - - - - -
bash: line 1: node: command not found

and I have started a test of all reverse (build) dependencies,

========================================================================
= Found reverse runtime, build, or test dependencies that can be tested!
========================================================================

autopkgtest
-----------

node-rollup node-uglifyjs-webpack-plugin
node-rollup-plugin-terser ruby-terser

rebuild
-------

almond node-ipaddr.js
impress.js node-is-stream
janus node-istanbul
jquery-coolfieldset node-jmespath
jquery-lazyload node-jquery-textcomplete
jquery-reflection node-jschardet
jquery-watermark node-markdown-it
jsxgraph node-markdown-it-html5-embed
leaflet node-marked
leaflet-markercluster node-md5-hex
less.js node-mem
node-base64-js node-mermaid
node-bootstrap-switch node-prismjs
node-chai node-prop-types
node-chance node-ramda
node-chart.js node-rollup-plugin-terser
node-configstore node-shiny-server-client
node-core-js node-slice-ansi
node-create-react-class node-sockjs-client
node-d3-force node-tap
node-d3-queue node-thenby
node-dagre-d3-renderer node-timeago.js
node-dagre-layout node-ua-parser-js
node-dateformat node-uglifyjs-webpack-plugin
node-dot-prop node-uvu
node-es6-promise node-vue-resource
node-events node-wrap-ansi
node-fecha popper.js
node-find-up psl.js
node-flatted ruby-rails-assets-jquery-nicescroll
node-formidable theano
node-fuzzaldrin-plus twitter-bootstrap4
node-graphlibrary underscore
node-has-ansi vue-router.js
node-i18next-http-backend vue.js

Which tests to run: [A(all)/e(dit list)]/s(kip all)]

========================================================================
= Testing reverse (build) dependencies
========================================================================


rebuild almond ...

Once the rebuilds and autopkgtests are complete, I will report back the
results here.

Pirate Praveen

unread,
Jun 2, 2022, 12:30:03 PM6/2/22
to


On വ്യാ, ജൂൺ 2 2022 at 09:34:47 വൈകു +05:30:00
Looks like many tests are failing with this error (probably we should
fix this and retry the full rebuilds to get a better status),

terser -o debian/impress.min.js js/impress.js
/usr/share/nodejs/terser/bin/terser:153
if (~opts.rawArgs.indexOf("--rename")) {
^

TypeError: Cannot read properties of undefined (reading 'indexOf')
at Object.<anonymous> (/usr/share/nodejs/terser/bin/terser:153:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js
(node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47

and some

node-chai:
uglifyjs.terser : Depends: node-terser (= 4.1.2-10) but it is not
going to be installed

It is coming from one of these packages still depending on
uglifyjs.terser instead of terser.

$ reverse-depends -b uglifyjs.terser
Reverse-Testsuite-Triggers
* node-babel7

Reverse-Build-Depends
* node-babel7
* node-big-integer
* node-webpack

Reverse-Build-Depends-Indep
* wims

pravi@mahishi:~$ reverse-depends uglifyjs.terser
Reverse-Depends
* webpack

Packages without architectures listed are reverse-dependencies in: all,
amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x

Since at least one package passed, I will wait for the whole tests to
complete.

rebuild node-chart.js ... PASS

Pirate Praveen

unread,
Jun 2, 2022, 12:40:04 PM6/2/22
to


On വ്യാ, ജൂൺ 2 2022 at 09:48:09 വൈകു +05:30:00
+05:30:00, Pirate Praveen <pra...@onenetbeyond.org> wrote:
> Looks like many tests are failing with this error (probably we should
> fix this and retry the full rebuilds to get a better status),
>
> terser -o debian/impress.min.js js/impress.js
> /usr/share/nodejs/terser/bin/terser:153
> if (~opts.rawArgs.indexOf("--rename")) {
> ^
>
> TypeError: Cannot read properties of undefined (reading 'indexOf')
> at Object.<anonymous> (/usr/share/nodejs/terser/bin/terser:153:19)
> at Module._compile (node:internal/modules/cjs/loader:1105:14)
> at Object.Module._extensions..js
> (node:internal/modules/cjs/loader:1159:10)
> at Module.load (node:internal/modules/cjs/loader:981:32)
> at Function.Module._load (node:internal/modules/cjs/loader:822:12)
> at Function.executeUserEntryPoint [as runMain]
> (node:internal/modules/run_main:77:12)
> at node:internal/main/run_main_module:17:47
>
> and some

I reproduce this on a sif chroot with terser installed from
experimental.

(debian-sid)pravi@mahishi:/tmp$ terser -o test.min.js test.js

/usr/share/nodejs/terser/bin/terser:153
if (~opts.rawArgs.indexOf("--rename")) {
^
TypeError: Cannot read properties of undefined (reading 'indexOf')
at Object.<anonymous> (/usr/share/nodejs/terser/bin/terser:153:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js
(node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47

/usr/share/nodejs/terser/tools/exit.js:14
throw exit;
^
[Function: exit]
(debian-sid)pravi@mahishi:/tmp$ cat test.js
console.log("Hello, World")

Yadd

unread,
Jun 2, 2022, 12:50:03 PM6/2/22
to
It's an error in commander patch, should be:

if (~program.rawArgs.indexOf("--rename")) {

> TypeError: Cannot read properties of undefined (reading 'indexOf')
>    at Object.<anonymous> (/usr/share/nodejs/terser/bin/terser:153:19)
>    at Module._compile (node:internal/modules/cjs/loader:1105:14)
>    at Object.Module._extensions..js
> (node:internal/modules/cjs/loader:1159:10)
>    at Module.load (node:internal/modules/cjs/loader:981:32)
>    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
>    at Function.executeUserEntryPoint [as runMain]
> (node:internal/modules/run_main:77:12)
>    at node:internal/main/run_main_module:17:47
>
> and some
>
> node-chai:
> uglifyjs.terser : Depends: node-terser (= 4.1.2-10) but it is not going
> to be installed

chai already build-depends on terser; not uglify.terser

Pirate Praveen

unread,
Jun 2, 2022, 1:00:04 PM6/2/22
to


On വ്യാ, ജൂൺ 2 2022 at 06:42:11 വൈകു +02:00:00
+02:00:00, Yadd <ya...@debian.org> wrote:
>> Looks like many tests are failing with this error (probably we
>> should fix this and retry the full rebuilds to get a better status),
>>
>> terser -o debian/impress.min.js js/impress.js
>> /usr/share/nodejs/terser/bin/terser:153
>> if (~opts.rawArgs.indexOf("--rename")) {
>
> It's an error in commander patch, should be:
>
> if (~program.rawArgs.indexOf("--rename")) {
>

Thanks, hope Jonas will upload a fix and I will try rebuilds again
later.

>> TypeError: Cannot read properties of undefined (reading 'indexOf')
>> at Object.<anonymous>
>> (/usr/share/nodejs/terser/bin/terser:153:19)
>> at Module._compile (node:internal/modules/cjs/loader:1105:14)
>> at Object.Module._extensions..js
>> (node:internal/modules/cjs/loader:1159:10)
>> at Module.load (node:internal/modules/cjs/loader:981:32)
>> at Function.Module._load
>> (node:internal/modules/cjs/loader:822:12)
>> at Function.executeUserEntryPoint [as runMain]
>> (node:internal/modules/run_main:77:12)
>> at node:internal/main/run_main_module:17:47
>>
>> and some
>>
>> node-chai:
>> uglifyjs.terser : Depends: node-terser (= 4.1.2-10) but it is not
>> going to be installed
>
> chai already build-depends on terser; not uglify.terser

yes, it also build depends on webpack which pulls this. I shared the
full list of packages build depending on uglifyjs.terser in a previous
reply.

Yadd

unread,
Jun 7, 2022, 2:40:03 AM6/7/22
to
On 02/06/2022 18:18, Pirate Praveen wrote:
>
>
All false positives: node-babel7, node-big-integer and node-webpack
already build-depends on terser

Yadd

unread,
Jun 7, 2022, 2:50:03 AM6/7/22
to
Sorry, I used a bad "grep -E". To be fixed:

libjs-fetch
node-bootstrap-switch
node-chance
node-commander
node-d3-color
node-dagre-d3-renderer
node-dagre-layout
node-graphlibrary
node-jmespath
node-jquery-textcomplete
node-lunr
node-markdown-it-html5-embed
node-natural-sort
node-terser
node-vue-template-compiler
node-webpack
popper.js
psl.js
twitter-bootstrap5
vue.js

Yadd

unread,
Jun 7, 2022, 4:10:04 AM6/7/22
to
All fixed now except node-babel7: I've to wait for 7.18.4 acceptance to
be able to recompile babel-standalone (and then push this fix)
0 new messages