#980406 node-xterm: likely broken build - JSON.parse: unexpected character at line 1 column 1 of the JSON data Resource #980406
- Package:
- node-xterm
- Source:
- node-xterm
- Submitter:
- Pirate Praveen
- Date:
- 2022-05-04 05:39:03 UTC
- Severity:
- important
- Tags:
When using packaged version of node-xterm in gitlab, the browser error console has these errors and it break web IDE of gitlab (the progress circle keeps spinning). Source map error: Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data Resource URL: http://gitlab-buster.lxc/assets/webpack/commons-pages.ide-pages.projects.environments.terminal-pages.projects.jobs.terminal.650166e5.chunk.js Source Map URL: commons-pages.ide-pages.projects.environments.terminal-pages.projects.jobs.terminal.650166e5.chunk.js.map Source map error: Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data Resource URL: http://gitlab-buster.lxc/assets/webpack/pages.ide.da3ccd82.chunk.js Source Map URL: pages.ide.da3ccd82.chunk.js.map Source map error: Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data Resource URL: http://gitlab-buster.lxc/assets/webpack/runtime.6c5d081d.bundle.js Source Map URL: runtime.6c5d081d.bundle.js.map When switching to npmjs.com distributed xterm, the error is gone. gitlab need xterm 3.14.5, so it is likely a version mismatch as well. I will check with xterm 3.8.1 from npmjs.com to confirm if it is a version mismatch or not. If it is a version mismatch I'll retitle this as a request for new upstream version.
I was able to use xterm 3.8.1 from nmpjs.com with gitlab without any issues. So this is a bug in node-xterm debian build.
Trying to switch to rollup instead of browserify-lite, but tsc itself
is failing now.
diff --git a/debian/control b/debian/control
index 6bc5004..f70533d 100644
--- a/debian/control
+++ b/debian/control
@@ -7,9 +7,12 @@ Priority: optional
Build-Depends: chai <!nocheck>,
debhelper-compat (= 12),
mocha <!nocheck>,
- node-browserify-lite,
+ rollup,
node-typescript,
node-typescript-types (>= 20190609~),
+ node-types-jquery,
+ node-types-jsdom,
+ node-types-mocha,
nodejs,
pkg-js-tools
Standards-Version: 4.5.0
diff --git a/debian/rules b/debian/rules
index d8dcc53..72fc167 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,17 +17,8 @@ override_dh_auto_build:
# Otherwise browserify-lite complains
touch lib/addons/index.js
mkdir -p dist
- cd dist && browserify-lite ../lib/xterm.js --outfile xterm.js
--standalone Terminal
- cd dist && for addon in $(ADDONS); do mkdir -p addons/$$addon &&
browserify-lite ../lib/addons/$$addon/$$addon.js --outfile
addons/$$addon/$$addon.js --standalone $$addon; done
-# Undo browserify-lite workarounds
- sed -i -e 's/REQUIRE_NO_BROWSERIFY/require/g' dist/xterm.js
dist/addons/*/*.js
-# browserify-lite seems to generate a module map with indexes starting
from zero, then tests
-# the truth of the module ID when loading sub-parts - which then fails
for whatever ends up
-# as sub-module 0; not convinced I fully understand what is happening
here, because it seems
-# like this should break everything browserify-life produces; dropping
this check makes it load;
- sed -i -e '/if [(]!id[)] throw new Error/d' dist/xterm.js
dist/addons/*/*.js
-
- rm -f dist/addons/index.js
+ cd dist && rollup ../lib/xterm.js -o xterm.js -f umd -name Terminal
+ cd dist && for addon in $(ADDONS); do mkdir -p addons/$$addon &&
rollup ../lib/addons/$$addon/$$addon.js -o addons/$$addon/$$addon.js -f
umd -name $$addon; done
cd src && find . -name '*.css' -exec cp -v --parents '{}' ../lib \;
cd src && find . -name '*.css' -exec cp -v --parents '{}' ../dist \;
On Tue, 19 Jan 2021 19:34:30 +0530 Pirate Praveen <praveen@onenetbeyond.org> wrote: > > > On Tue, Jan 19, 2021 at 2:24 pm, Pirate Praveen > <praveen@onenetbeyond.org> wrote: > > Control: severity -1 serious > > > > I was able to use xterm 3.8.1 from nmpjs.com with gitlab without any > > issues. So this is a bug in node-xterm debian build. > > Trying to switch to rollup instead of browserify-lite, but tsc itself > is failing now. So its currently FTBFS, we need to adapt to typescript-types change.
Le 19/01/2021 à 15:04, Pirate Praveen a écrit :--- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1636,7 +1636,9 @@ */ public log(text: string, data?: any): void { if (!this.options.debug) return; + // @ts-ignore if (!this._context.console || !this._context.console.log) return; + // @ts-ignore this._context.console.log(text, data); } @@ -1645,7 +1647,9 @@ */ public error(text: string, data?: any): void { if (!this.options.debug) return; + // @ts-ignore if (!this._context.console || !this._context.console.error) return; + // @ts-ignore this._context.console.error(text, data); }--- a/src/renderer/ColorManager.test.ts +++ b/src/renderer/ColorManager.test.ts @@ -15,6 +15,7 @@ beforeEach(() => { dom = new jsdom.JSDOM(''); + // @ts-ignore window = dom.window; document = window.document; (<any>window).HTMLCanvasElement.prototype.getContext = () => ({
I don't really understand this part. Can you fix this? thanks Praveen
We believe that the bug you reported is fixed in the latest version of node-xterm, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to 980406@bugs.debian.org, and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Pirate Praveen <praveen@debian.org> (supplier of updated node-xterm package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org) Format: 1.8 Date: Tue, 19 Jan 2021 23:59:29 +0530 Source: node-xterm Architecture: source Version: 3.8.1+~cs0.9.0-1 Distribution: unstable Urgency: medium Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org> Changed-By: Pirate Praveen <praveen@debian.org> Closes: 954678 979774 980406 Changes: node-xterm (3.8.1+~cs0.9.0-1) unstable; urgency=medium . * Team upload * Add node-pty as component * Use an older tags page for getting older versions * New upstream version 3.8.1+~cs0.9.0 * Add copyright for node-pty component * Document why the component is not built * Switch to rollup for building browser bundle (Closes: #980406) * Remove build dependency on node-typescript-types (Closes: #979774) * Ignore some type mismatches (Thanks to Xavier Guimard) (Closes: #954678) Checksums-Sha1: 008b684ee9d401346b4b79cfc3432c577ca8ff56 2533 node-xterm_3.8.1+~cs0.9.0-1.dsc e2bc26deb2bc7c3a6d27c8c817b57f2c2d5f5251 239001 node-xterm_3.8.1+~cs0.9.0.orig-node-pty.tar.gz 777a49e64267990b22d9abe1027a3d6f01143425 287514 node-xterm_3.8.1+~cs0.9.0.orig.tar.gz 40bdba5dc30887cdaf7ed0e1c9ad2c17f5cbe2cf 6024 node-xterm_3.8.1+~cs0.9.0-1.debian.tar.xz ca57d65959b2162ab27b56bdc7280dbdebec1752 12943 node-xterm_3.8.1+~cs0.9.0-1_amd64.buildinfo Checksums-Sha256: bbe2516dba88ced4244ee0e8cb5a3026f30b6849b88b380c084dce62ae746577 2533 node-xterm_3.8.1+~cs0.9.0-1.dsc 02100c1f7dd1bc16a7b3555e097ba1a0a8bcf9c116ec9d985c2d716d0f0f2bea 239001 node-xterm_3.8.1+~cs0.9.0.orig-node-pty.tar.gz 81ffa6c425126878c32dc9bcdc5dd7a5a5bc862e2ef063fc9bcbe03cf2fee31d 287514 node-xterm_3.8.1+~cs0.9.0.orig.tar.gz 05423ccc5e9060c0e6a21e72aadbdc101d20b2b95684dcef4aa28af267b98580 6024 node-xterm_3.8.1+~cs0.9.0-1.debian.tar.xz 94134042f3fe9829695c8b550e2572bd47436e097860a90a84ccc566826beb9c 12943 node-xterm_3.8.1+~cs0.9.0-1_amd64.buildinfo Files: 182d2a86906a17fbe0744060a76b6703 2533 javascript optional node-xterm_3.8.1+~cs0.9.0-1.dsc ad6db5bb6ac10dffeae24e5f25dd9484 239001 javascript optional node-xterm_3.8.1+~cs0.9.0.orig-node-pty.tar.gz 1b561d784cc784db39cb175346210f3e 287514 javascript optional node-xterm_3.8.1+~cs0.9.0.orig.tar.gz 2b6b55a5e00842a60abae3b9921eea53 6024 javascript optional node-xterm_3.8.1+~cs0.9.0-1.debian.tar.xz 519100d17d9b12dfc21d6ea7ab5ad900 12943 javascript optional node-xterm_3.8.1+~cs0.9.0-1_amd64.buildinfo -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE0whj4mAg5UP0cZqDj1PgGTspS3UFAmAHJroACgkQj1PgGTsp S3VGBBAArSIWk1Xyopvz5KUtyqL5SDE16neKXuyIh6mhUTY2lfbWGOPF8Bm7pV9a pfubHpL4ixmVNUcKqoQI41fj1yjidhMtNaq09fvpewZzQkgY5AqG1MsZO0ogGME5 MgN+6ykQuojLtFg3qyssaN4k8F18O2Lrj9UMkVFfe6diGPCQWJW0H+8N+yhMFmEp 3WoYFx320z/diYsLjy95jPR3296HKBVLgXtToWnRitM1DKgRmV9H6q3kAB25WfGb PNCxM1qS19/APGyIoMWOFb22G0NOLqeH0I5zRo7SMx4JCb9JCUnM7Wn7Rv9b8pKA ckUph/DbbPTCJvc1rskj50M+S0fZF3Sd2UuOWZuMVDG3B91CLIc+FOH/7uu9FLP0 mZxKozXOq5AiVF87+gE7+g+9ylZVuoG9Wjir9NTpStEYPY2yhsaVvHeJPPqRKamJ FutaEeMJ9uIMZvIdpATLDzoSrSDjUiJ0b7VjK4JIDDNQVOF7fr9fFtWbsZ4S3CPL grGPA8lVXbF9OFM/+j5eeOwpVd78mUbramjNTiyPSF/H0LU09EGvloDB26H7LybU XIjC0ys9jvb/i2ac+EVR5j2kpD4SV0ycSlRy07czgvZmuLKMLrAefDqcrsGDsXf1 RaSfG1339btQ8fQQW0nvDYvMQSq17kQA6rBISqdTOUfa4NzNPpY= =aXyA -----END PGP SIGNATURE-----
Control: reopen -1 Control: severity -1 important Control: tags -1 help I was testing with a wrong version of xterm. So reopening with a lower severity. gitlab should not be using the browser bundle but the node modules. Its probably the files that are not built that is causing the error. Need help with building node-pty component, which would enable us to build src/Terminal.integration.ts
Hi, I wanted to push node-xterm towards version 4, but I saw bug report #980406 about needing node-node-pty, so I tried my hand on the salsa repository for this would-be package. I managed to fix a few things, but I'm stuck on the last hurdle and upstream is proving pretty uncooperative: https://github.com/microsoft/node-pty/issues/539 Question: isn't src/windowsPtyAgent.ts just for the windows port of the lib, in which case it can somehow be dropped? If anybody has any answer or hint, don't hesitate... J.Puydt