Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update pako library. #1131

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.5",
"nib": "^1.1.2",
"pako": "^1.0.11",
"pako": "^2.0.4",
"phantomjs-prebuilt": "^2.1.5",
"pug": "^3.0.2",
"pug-lint": "^2.6.0",
Expand Down Expand Up @@ -147,8 +147,8 @@
"test-headed-xvfb": "GEOJS_TEST_CASE=tests/test-headed.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers ChromeFull",
"test-webglheadless": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
"test-webglheadless-all": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
"test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,PhantomJS",
"test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
"test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
"test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
"get-data-files": "node scripts/datastore.js dist/data",
"ci-clean": "git clean -fxd dist -e dist/data jsdoc/tmpl jsdoc/static images lcov",
"ci": "npm run ci-build && npm run ci-test",
Expand Down
5 changes: 3 additions & 2 deletions tutorials/common/tutorials.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function fill_codeblocks(query) {
/* Strip out white space and pluses, then convert ., -, and _ to /, +,
* =. By removing whitespace, the url is more robust against email
* handling. The others keep things short. */
var src = atob(query[key].replace(/(\s|\+)/g, '').replace(/\./g, '/').replace(/-/g, '+').replace(/_/g, '='));
let src = query[key].replace(/(\s|\+)/g, '').replace(/\./g, '/').replace(/-/g, '+').replace(/_/g, '=');
src = pako.inflate(src, {to: 'string', raw: true});
if ($('.CodeMirror', block).length) {
$('.CodeMirror', block)[0].CodeMirror.setValue(src);
Expand Down Expand Up @@ -287,7 +287,8 @@ function start_keeper(alwaysKeep) {
var src = $('.CodeMirror', block).length ? $('.CodeMirror', block)[0].CodeMirror.getValue() : $('textarea', block).val();
src = src.trim().replace(/ [ ]*\n/g, '\n');
if (src !== defaultSrc) {
var comp = btoa(pako.deflate(src, {to: 'string', level: 9, raw: true}));
let comp = pako.deflate(src, {to: 'string', level: 9, raw: true});
comp = btoa(String.fromCharCode.apply(null, comp));
/* instead of using regular base64, convert /, +, and = to ., -, and _
* so that they don't need to be escaped on the url. This reduces the
* average length of the url by 6 percent. */
Expand Down