From 6fea25c5ad1af8a5aeafa8da72c4821a78bd04db Mon Sep 17 00:00:00 2001 From: Alex Garnett Date: Mon, 26 Aug 2024 11:07:16 -0700 Subject: [PATCH 1/5] move dedenting to snippets --- src/Sync.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Sync.js b/src/Sync.js index b7192b3..51065e2 100644 --- a/src/Sync.js +++ b/src/Sync.js @@ -78,6 +78,11 @@ class Snippet { if (config.disable_ellipsis) { disable_ellipsis = true; } + if (config.enable_code_dedenting) { + let lineString = `${lines.join("\n")}\n`; + lineString = dedent(lineString); + lines = lineString.split("\n"); + } return lines; } @@ -136,13 +141,8 @@ class File { this.lines = []; } // fileString converts the array of lines into a string - fileString(dedentCode = false) { + fileString() { let lines = `${this.lines.join("\n")}\n`; - - if (dedentCode) { - lines = dedent(lines); - } - return lines; } } @@ -454,7 +454,7 @@ class Sync { for (const file of files) { await writeAsync( file.fullpath, - file.fileString(this.config.features.enable_code_dedenting) + file.fileString() ); this.progress.increment(); } From cfb1a11bd0c9a1faab8a845abe9409c94746e35e Mon Sep 17 00:00:00 2001 From: Alex Garnett Date: Mon, 26 Aug 2024 11:10:37 -0700 Subject: [PATCH 2/5] return lines --- src/Sync.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sync.js b/src/Sync.js index 51065e2..b8f5664 100644 --- a/src/Sync.js +++ b/src/Sync.js @@ -81,7 +81,7 @@ class Snippet { if (config.enable_code_dedenting) { let lineString = `${lines.join("\n")}\n`; lineString = dedent(lineString); - lines = lineString.split("\n"); + return lineString.split("\n"); } return lines; } From 01950bed1768d1f861889dfd3f50eb1cd2e44cb9 Mon Sep 17 00:00:00 2001 From: Alex Garnett Date: Mon, 26 Aug 2024 14:28:53 -0700 Subject: [PATCH 3/5] try to switch to string-dedent --- package.json | 2 +- src/Sync.js | 10 ++- yarn.lock | 213 +++++++++++++++------------------------------------ 3 files changed, 70 insertions(+), 155 deletions(-) diff --git a/package.json b/package.json index b926fd0..d558811 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "anzip": "^0.2.0", "arraybuffer-to-buffer": "^0.0.7", "cli-progress": "^3.8.2", - "dedent": "^1.5.3", + "string-dedent": "^3.0.1", "glob": "^7.1.6", "js-logger": "^1.6.1", "line-reader": "^0.4.0", diff --git a/src/Sync.js b/src/Sync.js index b8f5664..97d7c48 100644 --- a/src/Sync.js +++ b/src/Sync.js @@ -15,7 +15,7 @@ const { writeEnd, } = require("./common"); const { writeFile, unlink } = require("fs"); -const dedent = require("dedent"); +const dedent = require("string-dedent"); const path = require("path"); const arrayBuffToBuff = require("arraybuffer-to-buffer"); const anzip = require("anzip"); @@ -79,7 +79,8 @@ class Snippet { disable_ellipsis = true; } if (config.enable_code_dedenting) { - let lineString = `${lines.join("\n")}\n`; + let lineString = `\`\n${lines.join("\n")}\n\``; + console.debug(lineString); lineString = dedent(lineString); return lineString.split("\n"); } @@ -526,6 +527,11 @@ function overwriteConfig(current, extracted) { ? current.enable_code_block : extracted.enable_code_block; + config.enable_code_dedenting = + extracted?.enable_code_dedenting ?? true + ? current.enable_code_dedenting + : extracted.enable_code_dedenting; + if (extracted?.highlightedLines ?? undefined) { config.highlights = extracted.highlightedLines; } diff --git a/yarn.lock b/yarn.lock index 82cc8f4..2df2fb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,14 +10,6 @@ "@jridgewell/gen-mapping" "^0.1.0" "@jridgewell/trace-mapping" "^0.3.9" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.24.7": - version "7.24.7" - resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz" - integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== - dependencies: - "@babel/highlight" "^7.24.7" - picocolors "^1.0.0" - "@babel/code-frame@7.0.0-beta.36": version "7.0.0-beta.36" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz" @@ -27,12 +19,20 @@ esutils "^2.0.2" js-tokens "^3.0.0" +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.24.7": + version "7.24.7" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== + dependencies: + "@babel/highlight" "^7.24.7" + picocolors "^1.0.0" + "@babel/compat-data@^7.20.0": version "7.20.1" resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.1.tgz" integrity sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ== -"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.8.0": +"@babel/core@^7.11.6", "@babel/core@^7.12.3": version "7.20.2" resolved "https://registry.npmjs.org/@babel/core/-/core-7.20.2.tgz" integrity sha512-w7DbG8DtMrJcFOi4VrLm+8QM4az8Mo+PuLBKLp2zrYRCow8W/f9xiXm5sN53C8HksCyDQwCKha9JiDoIyPjT2g== @@ -266,6 +266,16 @@ dependencies: "@babel/helper-plugin-utils" "^7.19.0" +"@babel/template@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.36.tgz" + integrity sha512-mUBi90WRyZ9iVvlWLEdeo8gn/tROyJdjKNC4W5xJTSZL+9MS89rTJSqiaJKXIkxk/YRDL/g/8snrG/O0xl33uA== + dependencies: + "@babel/code-frame" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + lodash "^4.2.0" + "@babel/template@^7.18.10", "@babel/template@^7.25.0": version "7.25.0" resolved "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz" @@ -284,30 +294,21 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/template@7.0.0-beta.36": +"@babel/traverse@7.0.0-beta.36": version "7.0.0-beta.36" - resolved "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.36.tgz" - integrity sha512-mUBi90WRyZ9iVvlWLEdeo8gn/tROyJdjKNC4W5xJTSZL+9MS89rTJSqiaJKXIkxk/YRDL/g/8snrG/O0xl33uA== + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.36.tgz" + integrity sha512-OTUb6iSKVR/98dGThRJ1BiyfwbuX10BVnkz89IpaerjTPRhDfMBfLsqmzxz5MiywUOW4M0Clta0o7rSxkfcuzw== dependencies: "@babel/code-frame" "7.0.0-beta.36" + "@babel/helper-function-name" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" babylon "7.0.0-beta.36" - lodash "^4.2.0" - -"@babel/traverse@^7.20.1": - version "7.25.4" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.4.tgz" - integrity sha512-VJ4XsrD+nOvlXyLzmLzUs/0qjFS4sK30te5yEFlvbbUNEgKaVb2BHZUpAL+ttLPQAHNrsI3zZisbfha5Cvr8vg== - dependencies: - "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.4" - "@babel/parser" "^7.25.4" - "@babel/template" "^7.25.0" - "@babel/types" "^7.25.4" - debug "^4.3.1" + debug "^3.0.1" globals "^11.1.0" + invariant "^2.2.0" + lodash "^4.2.0" -"@babel/traverse@^7.7.2": +"@babel/traverse@^7.20.1", "@babel/traverse@^7.7.2": version "7.25.4" resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.4.tgz" integrity sha512-VJ4XsrD+nOvlXyLzmLzUs/0qjFS4sK30te5yEFlvbbUNEgKaVb2BHZUpAL+ttLPQAHNrsI3zZisbfha5Cvr8vg== @@ -320,39 +321,16 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/traverse@7.0.0-beta.36": +"@babel/types@7.0.0-beta.36": version "7.0.0-beta.36" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.36.tgz" - integrity sha512-OTUb6iSKVR/98dGThRJ1BiyfwbuX10BVnkz89IpaerjTPRhDfMBfLsqmzxz5MiywUOW4M0Clta0o7rSxkfcuzw== + resolved "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.36.tgz" + integrity sha512-PyAORDO9um9tfnrddXgmWN9e6Sq9qxraQIt5ynqBOSXKA5qvK1kUr+Q3nSzKFdzorsiK+oqcUnAFvEoKxv9D+Q== dependencies: - "@babel/code-frame" "7.0.0-beta.36" - "@babel/helper-function-name" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" - babylon "7.0.0-beta.36" - debug "^3.0.1" - globals "^11.1.0" - invariant "^2.2.0" + esutils "^2.0.2" lodash "^4.2.0" - -"@babel/types@^7.0.0": - version "7.20.2" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.20.2.tgz" - integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== - dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" -"@babel/types@^7.18.10", "@babel/types@^7.3.3": - version "7.20.2" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.20.2.tgz" - integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== - dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" - to-fast-properties "^2.0.0" - -"@babel/types@^7.18.6": +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.3.0", "@babel/types@^7.3.3": version "7.20.2" resolved "https://registry.npmjs.org/@babel/types/-/types-7.20.2.tgz" integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== @@ -370,24 +348,6 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" -"@babel/types@^7.3.0": - version "7.20.2" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.20.2.tgz" - integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== - dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" - to-fast-properties "^2.0.0" - -"@babel/types@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.36.tgz" - integrity sha512-PyAORDO9um9tfnrddXgmWN9e6Sq9qxraQIt5ynqBOSXKA5qvK1kUr+Q3nSzKFdzorsiK+oqcUnAFvEoKxv9D+Q== - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^2.0.0" - "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" @@ -691,7 +651,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -711,7 +671,7 @@ dependencies: "@octokit/types" "^6.0.3" -"@octokit/core@^3.5.1", "@octokit/core@>=2", "@octokit/core@>=3": +"@octokit/core@^3.5.1": version "3.6.0" resolved "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz" integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q== @@ -973,7 +933,7 @@ acorn-jsx@^5.3.2: resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.8.0: +acorn@^8.8.0: version "8.8.1" resolved "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz" integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== @@ -1007,14 +967,7 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.0.0: - version "4.3.0" - resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^4.1.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== @@ -1165,7 +1118,7 @@ braces@^3.0.3: dependencies: fill-range "^7.1.1" -browserslist@^4.21.3, "browserslist@>= 4.21.0": +browserslist@^4.21.3: version "4.21.4" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz" integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== @@ -1212,16 +1165,7 @@ caniuse-lite@^1.0.30001400: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz" integrity sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ== -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1294,16 +1238,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - color-name@1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + colors@^1.1.2: version "1.4.0" resolved "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz" @@ -1347,11 +1291,6 @@ dedent@^0.7.0: resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz" integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== -dedent@^1.5.3: - version "1.5.3" - resolved "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz" - integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== - deep-is@^0.1.3: version "0.1.4" resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" @@ -1486,7 +1425,7 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -"eslint@^6.0.0 || ^7.0.0 || ^8.0.0", "eslint@^6.0.0 || ^7.0.0 || >=8.0.0", eslint@^8.20.0, eslint@>=5: +eslint@^8.20.0: version "8.27.0" resolved "https://registry.npmjs.org/eslint/-/eslint-8.27.0.tgz" integrity sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ== @@ -1564,12 +1503,7 @@ estraverse@^4.1.1: resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0: - version "5.3.0" - resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -estraverse@^5.2.0: +estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -1671,15 +1605,7 @@ fill-range@^7.1.1: dependencies: to-regex-range "^5.0.1" -find-up@^4.0.0: - version "4.1.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -find-up@^4.1.0: +find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -2193,7 +2119,7 @@ jest-resolve-dependencies@^28.1.3: jest-regex-util "^28.0.2" jest-snapshot "^28.1.3" -jest-resolve@*, jest-resolve@^28.1.3: +jest-resolve@^28.1.3: version "28.1.3" resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-28.1.3.tgz" integrity sha512-Z1W3tTjE6QaNI90qo/BJpfnvpxtaFTFw5CDgwpyE/Kz8U/06N1Hjf4ia9quUhCh39qIGWF1ZuxFiBiJQwSEYKQ== @@ -2359,16 +2285,16 @@ js-sdsl@^4.1.4: resolved "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz" integrity sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q== -"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" @@ -2519,7 +2445,7 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" -ms@^2.1.1, ms@2.1.2: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -2690,12 +2616,7 @@ picomatch@^2.0.4, picomatch@^2.2.1: resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== -picomatch@^2.2.3: - version "2.3.1" - resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -picomatch@^2.3.1: +picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -2822,12 +2743,7 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -semver@^6.0.0: - version "6.3.1" - resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^6.3.0: +semver@^6.0.0, semver@^6.3.0: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -2889,6 +2805,11 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" +string-dedent@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/string-dedent/-/string-dedent-3.0.1.tgz#a3e8fb946cd8af80cb51bf54b19dbcae8b6a39f4" + integrity sha512-A2zCXSgpPrpFi1lDJlDwIPYakBWeDtQZ8ZBKssB8M/WbtNEKTzsl1yCDRmHx55jSB27xZDQ6NOtRYekESWx6fw== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" @@ -2951,14 +2872,7 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0: - version "7.2.0" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^7.1.0: +supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -3063,11 +2977,6 @@ type-fest@^0.21.3: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -"typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta": - version "5.5.4" - resolved "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz" - integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== - universal-user-agent@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz" From 116d41fb515f815e8b43e9ec749bc95350ceda08 Mon Sep 17 00:00:00 2001 From: Alex Garnett Date: Mon, 26 Aug 2024 18:56:51 -0700 Subject: [PATCH 4/5] change formatting for string-dedent --- src/Sync.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Sync.js b/src/Sync.js index 97d7c48..dd54f0b 100644 --- a/src/Sync.js +++ b/src/Sync.js @@ -79,7 +79,9 @@ class Snippet { disable_ellipsis = true; } if (config.enable_code_dedenting) { - let lineString = `\`\n${lines.join("\n")}\n\``; + let lineString = ` + ${lines.join("\n")} + `; console.debug(lineString); lineString = dedent(lineString); return lineString.split("\n"); From fa9b21a515517bd6c566cf23263306c2056c3d39 Mon Sep 17 00:00:00 2001 From: Alex Garnett Date: Mon, 26 Aug 2024 19:05:35 -0700 Subject: [PATCH 5/5] remove console.debug() --- src/Sync.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Sync.js b/src/Sync.js index dd54f0b..5e6a267 100644 --- a/src/Sync.js +++ b/src/Sync.js @@ -82,7 +82,6 @@ class Snippet { let lineString = ` ${lines.join("\n")} `; - console.debug(lineString); lineString = dedent(lineString); return lineString.split("\n"); }