From aeba91476102f61caf94f17814ff506d8f5c81f9 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Tue, 17 Sep 2024 09:31:41 +1000 Subject: [PATCH 01/11] tests: add test cases for gts and gjs files --- packages/graphql-tag-pluck/package.json | 2 + .../tests/graphql-tag-pluck.test.ts | 213 +++++++++++++ yarn.lock | 283 +++++++++++++++--- 3 files changed, 463 insertions(+), 35 deletions(-) diff --git a/packages/graphql-tag-pluck/package.json b/packages/graphql-tag-pluck/package.json index 924c66e26f2..97089354973 100644 --- a/packages/graphql-tag-pluck/package.json +++ b/packages/graphql-tag-pluck/package.json @@ -63,9 +63,11 @@ "@babel/parser": "7.25.6", "@babel/traverse": "7.25.6", "@babel/types": "7.25.6", + "@glimmer/syntax": "^0.92.3", "@types/babel__traverse": "7.20.6", "@vue/compiler-sfc": "3.5.6", "astrojs-compiler-sync": "^1.0.0", + "glint": "^0.0.25", "svelte": "4.2.19", "svelte2tsx": "0.7.19" }, diff --git a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts index e67f78d8c5a..99bb9f6f816 100644 --- a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts +++ b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts @@ -2393,5 +2393,218 @@ describe('graphql-tag-pluck', () => { 'query queryName { id }\n#EXPRESSION:ANOTHER_VARIABLE', ); }); + + it('should pluck graphql-tag template literals from .gts file', async () => { + const sources = await pluck( + 'tmp-XXXXXX.gts', + freeText(` + import gql from 'graphql-tag'; + + const query = gql\` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + \`; + + export default class ExampleComponent extends Component {} + `), + ); + + expect(sources.map(source => source.body).join('\n\n')).toEqual( + freeText(` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + `), + ); + }); + + it('should pluck graphql-tag template literals from .gjs file', async () => { + const sources = await pluck( + 'tmp-XXXXXX.gjs', + freeText(` + import gql from 'graphql-tag'; + + const query = gql\` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + \`; + + export default class ExampleComponent extends Component {} + `), + ); + + expect(sources.map(source => source.body).join('\n\n')).toEqual( + freeText(` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + `), + ); + }); + + it('should pluck graphql-tag template literals from .gts file with 2 queries', async () => { + const sources = await pluck( + 'tmp-XXXXXX.gts', + freeText(` + import gql from 'graphql-tag'; + + const query1 = gql\` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + \`; + + const query2 = gql\` + query IndexQuery2 { + site { + siteMetadata { + title + } + } + } + \`; + + export default class ExampleComponent extends Component {} + `), + ); + + expect(sources.map(source => source.body).join('\n\n')).toEqual( + freeText(` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + + query IndexQuery2 { + site { + siteMetadata { + title + } + } + } + `), + ); + }); + + it('should pluck graphql-tag template literals from .gts file with multiple script sections', async () => { + const sources = await pluck( + 'tmp-XXXXXX.gts', + freeText(` + import Component from '@glimmer/component'; + + const query1 = gql\` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + \`; + + export function anotherQuery() { + const query2 = gql\` + query IndexQuery2 { + site { + siteMetadata { + title + } + } + } + \`; + } + + export default class ExampleComponent extends Component {} + `), + ); + + expect(sources.map(source => source.body).join('\n\n')).toEqual( + freeText(` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + + query IndexQuery2 { + site { + siteMetadata { + title + } + } + } + `), + ); + }); + + it('should pluck graphql-tag template literals from .gts file, ignoring comments', async () => { + const sources = await pluck( + 'tmp-XXXXXX.gts', + freeText(` + import gql from 'graphql-tag'; + + const query = gql\` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + \`; + + // const query2 = gql\` + // query IndexQuery2 { + // site { + // siteMetadata { + // title + // } + // } + // } + // \`; + + export default class ExampleComponent extends Component {} + `), + ); + + expect(sources.map(source => source.body).join('\n\n')).toEqual( + freeText(` + query IndexQuery { + site { + siteMetadata { + title + } + } + } + `), + ); + }); }); }); diff --git a/yarn.lock b/yarn.lock index 5c98ab49623..645502bec42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1690,6 +1690,45 @@ dependencies: giscus "^1.5.0" +"@glimmer/env@0.1.7": + version "0.1.7" + resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07" + integrity sha512-JKF/a9I9jw6fGoz8kA7LEQslrwJ5jms5CXhu/aqkBWk+PmZ6pTl8mlb/eJ/5ujBGTiQzBhy5AIWF712iA+4/mw== + +"@glimmer/interfaces@0.92.3": + version "0.92.3" + resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.92.3.tgz#dd2e8d9df59fcebf2fa35a78cc2353738b09d762" + integrity sha512-QwQeA01N+0h+TAi/J7iUnZtRuJy+093hNyagxDQBA6b1wCBw+q+al9+O6gmbWlkWE7EifzmNE1nnrgcecJBlJQ== + dependencies: + "@simple-dom/interface" "^1.4.0" + +"@glimmer/syntax@^0.92.3": + version "0.92.3" + resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.92.3.tgz#0b0923d37469509fcc46243678c7ef8cb41a17de" + integrity sha512-7wPKQmULyXCYf0KvbPmfrs/skPISH2QGR9atCnmDWnHyLv5SSZVLm1P0Ctrpta6+Ci3uGQb7hGk0IjsLEavcYQ== + dependencies: + "@glimmer/interfaces" "0.92.3" + "@glimmer/util" "0.92.3" + "@glimmer/wire-format" "0.92.3" + "@handlebars/parser" "~2.0.0" + simple-html-tokenizer "^0.5.11" + +"@glimmer/util@0.92.3": + version "0.92.3" + resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.92.3.tgz#ac97cf68118d9868b405a2078e3b28603d0ccf57" + integrity sha512-K1oH93gGU36slycxJ9CcFpUTsdOc4XQ6RuZFu5oRsxFYtEF5PSu7ik11h58fyeoaWOr1ebfkyAMawbeI2AJ5GA== + dependencies: + "@glimmer/env" "0.1.7" + "@glimmer/interfaces" "0.92.3" + +"@glimmer/wire-format@0.92.3": + version "0.92.3" + resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.92.3.tgz#0d6d51d657193c806763fa059c0345e6376f461f" + integrity sha512-gFz81Q9+V7Xs0X8mSq6y8qacHm0dPaGJo2/Bfcsdow1hLOKNgTCLr4XeDBhRML8f6I6Gk9ugH4QDxyIOXOpC4w== + dependencies: + "@glimmer/interfaces" "0.92.3" + "@glimmer/util" "0.92.3" + "@graphql-tools/utils@^8.5.2": version "8.13.1" resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.13.1.tgz#b247607e400365c2cd87ff54654d4ad25a7ac491" @@ -1734,6 +1773,11 @@ "@repeaterjs/repeater" "^3.0.4" tslib "^2.5.2" +"@handlebars/parser@~2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-2.0.0.tgz#5e8b7298f31ff8f7b260e6b7363c7e9ceed7d9c5" + integrity sha512-EP9uEDZv/L5Qh9IWuMUGJRfwhXJ4h1dqKTT4/3+tY0eu7sPis7xh23j61SYUnNF4vqCQvvUXpDo9Bh/+q1zASA== + "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -2465,6 +2509,11 @@ resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== +"@simple-dom/interface@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@simple-dom/interface/-/interface-1.4.0.tgz#e8feea579232017f89b0138e2726facda6fbb71f" + integrity sha512-l5qumKFWU0S+4ZzMaLXFU8tQZsicHEMEyAxI5kDFGhJsRqDwe0a7/iPA/GdxlGyDKseQQAgIz5kzU7eXTrlSpA== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -3482,6 +3531,11 @@ ajv@^8.0.0, ajv@^8.9.0: json-schema-traverse "^1.0.0" require-from-string "^2.0.2" +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg== + ansi-colors@^4.1.1, ansi-colors@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" @@ -3711,11 +3765,21 @@ async-retry@^1.3.3: dependencies: retry "0.13.1" +async@0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/async/-/async-0.2.6.tgz#ad3f373d9249ae324881565582bc90e152abbd68" + integrity sha512-LTdAJ0KBRK5o4BlBlUoGvfGNOMON+NLbONgDZk80SX0G8LQZyjN+74nNADIpQ/+rxun6+fYm7z4vIzAB51UKUA== + async@^3.2.3: version "3.2.6" resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== +async@~0.1.22: + version "0.1.22" + resolved "https://registry.yarnpkg.com/async/-/async-0.1.22.tgz#0fc1aaa088a0e3ef0ebe2d8831bab0dcf8845061" + integrity sha512-2tEzliJmf5fHNafNwQLJXUasGzQCVctvsNkXmnlELHwypU0p08/rHohYvkqKIjyXpx+0rkrYv6QbhJ+UF4QkBg== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -4282,6 +4346,13 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.0.tgz#677de7ed7efff67cc40c9bf1897fea79d41b5215" integrity sha512-N1NGmowPlGBLsOZLPvm48StN04V4YvQRL0i6b7ctrVY3epjP/ct7hFLOItz6pDIvRjwpfPxi52a2UWV2ziir8g== +clean-css@0.10.x: + version "0.10.2" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-0.10.2.tgz#aacdc3332dfe9a75970c73ac4ac7bcbbd09a1d67" + integrity sha512-gBhmkCTMPgrtef2l0BaXZ7CHpS4Ji35pZANpc85xEk7caGoR1CGsek9BHLb06dt+jwDE8Sj1gBsQA7mC0yagEA== + dependencies: + commander "1.1.x" + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -4398,6 +4469,11 @@ colorette@^2.0.20: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== +colors@0.6.0-1: + version "0.6.0-1" + resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.0-1.tgz#6dbb68ceb8bc60f2b313dcc5ce1599f06d19e67a" + integrity sha512-ZaQtySU44lmZRP6M+CovFWnu7QnxLTsr/3wURb7BCOV1/gKjUb/3uu3NsLR+fvA2Jfs6sNfwcVq0Tp2mWYbuxg== + combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -4410,6 +4486,18 @@ comma-separated-tokens@^2.0.0: resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee" integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== +commander@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-0.6.1.tgz#fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06" + integrity sha512-0fLycpl1UMTGX257hRsu/arL/cUbcvQM4zMKwvLvzXtfdezIV4yotPS2dYtknF+NmEfWSoCEF6+hj9XLm/6hEw== + +commander@1.1.x: + version "1.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-1.1.1.tgz#50d1651868ae60eccff0a2d9f34595376bc6b041" + integrity sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA== + dependencies: + keypress "0.1.x" + commander@7, commander@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" @@ -4674,6 +4762,11 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" +cssom@0.2.x: + version "0.2.5" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.2.5.tgz#2682709b5902e7212df529116ff788cd5b254894" + integrity sha512-b9ecqKEfWrNcyzx5+1nmcfi80fPp8dVM8rlAh7fFK14PZbNjp++gRjyZTZfLJQa/Lw0qeCJho7WBIl0nw0v6HA== + csstype@^3.0.2: version "3.1.3" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" @@ -5034,6 +5127,13 @@ debounce@^1.2.1: resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5" integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== +debug@*, debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.6, debug@^4.3.7, debug@~4.3.6: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + debug@2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -5041,13 +5141,6 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.6, debug@^4.3.7, debug@~4.3.6: - version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" - integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== - dependencies: - ms "^2.1.3" - debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -6286,6 +6379,16 @@ fs-capacitor@^8.0.0: resolved "https://registry.yarnpkg.com/fs-capacitor/-/fs-capacitor-8.0.0.tgz#a95cbcf58dd50750fe718a03ec051961ef4e61f4" integrity sha512-+Lk6iSKajdGw+7XYxUkwIzreJ2G1JFlYOdnKJv5PzwFLVsoJYBpCuS7WPIUSNT1IbQaEWT1nhYU63Ud03DyzLA== +fs-extra@0.5.x: + version "0.5.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.5.0.tgz#34646dc62c97fa13b1024946bf4174e8c0f05ca4" + integrity sha512-JksTHiXJLXJoHfDNsTjAWUfXD4nOEocEg/fe0dbQK0cPb82bcv64+hm093rwzHvKyDnRnmriP2ajRgnGx7+d2Q== + dependencies: + jsonfile "0.0.x" + mkdirp "0.3.x" + ncp "0.2.x" + rimraf "~2.1.2" + fs-extra@^11.1.0, fs-extra@^11.2.0: version "11.2.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" @@ -6337,6 +6440,14 @@ fs-minipass@^3.0.0: dependencies: minipass "^7.0.3" +fs.notify@0.0.x: + version "0.0.4" + resolved "https://registry.yarnpkg.com/fs.notify/-/fs.notify-0.0.4.tgz#63284d45a34b52ce60088a6ddbec5b776d3c013d" + integrity sha512-xnulkRf31FQwC8NsU5DEYqMTeM3jZpYsTC2hHQcHlkXTubxQHDVWkau13U/oFmFXieCkai2oKTa1MhckXk2fRQ== + dependencies: + async "~0.1.22" + retry "~0.6.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -6475,6 +6586,22 @@ github-slugger@^2.0.0: resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-2.0.0.tgz#52cf2f9279a21eb6c59dd385b410f0c0adda8f1a" integrity sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw== +glint@^0.0.25: + version "0.0.25" + resolved "https://registry.yarnpkg.com/glint/-/glint-0.0.25.tgz#fe74ccc1c14c9edfa9c79b50cf9083b2b704eb10" + integrity sha512-gCcGGTlZTzVff7nZLFDd4zkhXTULAJ9/EQgTGvq7LeZareEm0jQhCTHNVYAuKsK3U3A2+NYg9DY4xYFwuZEzbQ== + dependencies: + async "0.2.6" + clean-css "0.10.x" + commander "1.1.x" + fs-extra "0.5.x" + fs.notify "0.0.x" + jade "0.28.x" + nib "0.9.x" + node-sass "0.4.3" + stylus "0.29.x" + uglify-js "2.2.x" + glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -6576,6 +6703,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +graceful-fs@~1: + version "1.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" + integrity sha512-iiTUZ5vZ+2ZV+h71XAgwCSu6+NAizhFU3Yw8aC/hH5SQ3SnISqEqAek40imAFGtDcwJKNhXvSY+hzIolnLwcdQ== + graphemer@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" @@ -7496,6 +7628,14 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" +jade@0.28.x: + version "0.28.2" + resolved "https://registry.yarnpkg.com/jade/-/jade-0.28.2.tgz#29ddaafcb42ed6fb7305f8f47379fff70fc77880" + integrity sha512-/u7Gr2BD2KIPl8+91eiuOrgsMOMDXrEzh8VWi60NJXdKTyHYCJTobTKkL8fU8iGvbkPnf9T37YsKVIjQUlcGMw== + dependencies: + commander "0.6.1" + mkdirp "0.3.x" + jake@^10.8.5: version "10.9.2" resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.2.tgz#6ae487e6a69afec3a5e167628996b59f35ae2b7f" @@ -7986,6 +8126,11 @@ jsonc-parser@^3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4" integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ== +jsonfile@0.0.x: + version "0.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-0.0.1.tgz#b5f9f515121b2844f2cbfe14338b55c79800e1d8" + integrity sha512-exg1z4OyWfLfB05WCTNg+PB8MBSEBnRoRU6MjnE+GXRba1P2wfAvB0ISUWJM2Ve3M6JJlNHBJ4nFXEzjji/4HQ== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -8014,6 +8159,11 @@ katex@^0.16.0, katex@^0.16.9: dependencies: commander "^8.3.0" +keypress@0.1.x: + version "0.1.0" + resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a" + integrity sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA== + keyv@^4.5.4: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -9413,6 +9563,11 @@ mj-context-menu@^0.6.1: resolved "https://registry.yarnpkg.com/mj-context-menu/-/mj-context-menu-0.6.1.tgz#a043c5282bf7e1cf3821de07b13525ca6f85aa69" integrity sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA== +mkdirp@0.3.x: + version "0.3.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7" + integrity sha512-8OCq0De/h9ZxseqzCH8Kw/Filf5pF/vMI6+BH7Lu0jXz2pqYCjTAQRolSxRIi+Ax+oCCjlxoJMP0YQ4XlrQNHg== + mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -9467,6 +9622,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +ncp@0.2.x: + version "0.2.7" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-0.2.7.tgz#46fac2b7dda2560a4cb7e628677bd5f64eac5be1" + integrity sha512-wPUepcV37u3Mw+ktjrUbl3azxwAkcD9RrVLQGlpSapWcEQM5jL0g8zwKo6ukOjVQAAEjqpRdLeojOalqqySpCg== + negotiator@0.6.3, negotiator@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" @@ -9582,6 +9742,13 @@ nextra@3.0.0-alpha.32: zod "^3.22.3" zod-validation-error "^3.0.0" +nib@0.9.x: + version "0.9.2" + resolved "https://registry.yarnpkg.com/nib/-/nib-0.9.2.tgz#f14570cd0c9a37609b3b662a5e6fc8fb1c6c269e" + integrity sha512-8e1pkjRQSF8+HlwPJUytj+JDsDBuGQh7hnKzpwh4qoIvEol8SuDsCqOgGRL91d4HvfeIiBT9iyDII2gmDmA1Uw== + dependencies: + stylus "0.31.x" + nlcst-to-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/nlcst-to-string/-/nlcst-to-string-4.0.0.tgz#05511e8461ebfb415952eb0b7e9a1a7d40471bd4" @@ -9629,6 +9796,15 @@ node-releases@^2.0.18: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== +node-sass@0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-0.4.3.tgz#2061041cd770f33fecb64929dd81aa9a84e2f1a5" + integrity sha512-7KDytxfSbtUjXXjGCef9soqqD//a17rLs3+vJ2unik1SVnVRu2SABtdZ2mOdBQjlmmgQE1qXg+VYmqKDAGoSEQ== + dependencies: + colors "0.6.0-1" + mkdirp "0.3.x" + optimist "0.3.x" + non-layered-tidy-tree-layout@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz#57d35d13c356643fc296a55fb11ac15e74da7804" @@ -9818,6 +9994,13 @@ optimism@^0.18.0: "@wry/trie" "^0.4.3" tslib "^2.3.0" +optimist@0.3.x, optimist@~0.3.5: + version "0.3.7" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.7.tgz#c90941ad59e4273328923074d2cf2e7cbc6ec0d9" + integrity sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ== + dependencies: + wordwrap "~0.0.2" + optionator@^0.9.3: version "0.9.4" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" @@ -11024,6 +11207,11 @@ retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== +retry@~0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.6.1.tgz#fdc90eed943fde11b893554b8cc63d0e899ba918" + integrity sha512-txv1qsctZq8ei9J/uCXgaKKFPjlBB0H2hvtnzw9rjKWFNUFtKh59WprXxpAeAey3/QeWwHdxMFqStPaOAgy+dA== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -11041,6 +11229,13 @@ rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@~2.1.2: + version "2.1.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.1.4.tgz#5a6eb62eeda068f51ede50f29b3e5cd22f3d9bb2" + integrity sha512-tzwmX16YQhcFu0T/m0gHBcFKx6yQAg77Z6WWaQSJsUekXYa6yaAmHhrDdmFicgauX/er7GsdN+vRao3mBhA4kQ== + optionalDependencies: + graceful-fs "~1" + robust-predicates@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.2.tgz#d5b28528c4824d20fc48df1928d41d9efa1ad771" @@ -11335,6 +11530,11 @@ signedsource@^1.0.0: resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" integrity sha512-6+eerH9fEnNmi/hyM1DXcRK3pWdoMQtlkQ+ns0ntzunjKqp5i3sKCc80ym8Fib3iaYhdJUOPdhlJWj1tvge2Ww== +simple-html-tokenizer@^0.5.11: + version "0.5.11" + resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.11.tgz#4c5186083c164ba22a7b477b7687ac056ad6b1d9" + integrity sha512-C2WEK/Z3HoSFbYq8tI7ni3eOo/NneSPRoPpcM7WdLjFOArFuyXEjAoCdOC3DgMfRyziZQ1hCNR4mrNdWEvD0og== + sirv@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/sirv/-/sirv-2.0.4.tgz#5dd9a725c578e34e449f332703eb2a74e46a29b0" @@ -11447,6 +11647,13 @@ source-map@^0.7.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== +source-map@~0.1.7: + version "0.1.43" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" + integrity sha512-VtCvB9SIQhk3aF6h+N85EaqIaBFIAfZ9Cu+NJHHVvc8BbEcnvDcFw6sqQ2dQrT6SlOrZq3tIvyD9+EGq/lJryQ== + dependencies: + amdefine ">=0.0.4" + space-separated-tokens@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz#1ecd9d2350a3844572c3f4a312bceb018348859f" @@ -11539,16 +11746,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -11611,14 +11809,7 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -11701,6 +11892,24 @@ stylis@^4.1.3: resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.4.tgz#ca5c6c4a35c4784e4e93a2a24dc4e9fa075250a4" integrity sha512-osIBl6BGUmSfDkyH2mB7EFvCJntXDrLhKjHTRj/rK6xLH0yuPrHULDRQzKokSOD4VoorhtKpfcfW1GAntu8now== +stylus@0.29.x: + version "0.29.0" + resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.29.0.tgz#508a8d350a270e23e1900c20ac5604b9a190b611" + integrity sha512-bvhqBONMi+nFyyjONXIs4OJygsxyY/bF6KjYNgz9SUZF7lnJOdBWCNOaXwOkFRcWrAp0vx00dSiwkGt2Muv7Dw== + dependencies: + cssom "0.2.x" + debug "*" + mkdirp "0.3.x" + +stylus@0.31.x: + version "0.31.0" + resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.31.0.tgz#b4f807aa067f071ab707f2c8ae143ab3211e51b2" + integrity sha512-BJ7iU9iUNOj/HlTuUF9SHh994ooIrOr/yYxzzQzpsweulT0HPyL4vtel9/QJcvq+xwy3ff7sf9Nv25kATr2qww== + dependencies: + cssom "0.2.x" + debug "*" + mkdirp "0.3.x" + subscriptions-transport-ws@0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/subscriptions-transport-ws/-/subscriptions-transport-ws-0.11.0.tgz#baf88f050cba51d52afe781de5e81b3c31f89883" @@ -12214,6 +12423,14 @@ ua-parser-js@^1.0.35: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.38.tgz#66bb0c4c0e322fe48edfe6d446df6042e62f25e2" integrity sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ== +uglify-js@2.2.x: + version "2.2.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.2.5.tgz#a6e02a70d839792b9780488b7b8b184c095c99c7" + integrity sha512-viLk+/8G0zm2aKt1JJAVcz5J/5ytdiNaIsKgrre3yvSUjwVG6ZUujGH7E2TiPigZUwLYCe7eaIUEP2Zka2VJPA== + dependencies: + optimist "~0.3.5" + source-map "~0.1.7" + uglify-js@^3.1.4: version "3.19.3" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" @@ -12763,7 +12980,12 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw== + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -12781,15 +13003,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From d499109a7faf5fc3c380d9ff4e627ab4d6615d65 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Tue, 17 Sep 2024 09:38:44 +1000 Subject: [PATCH 02/11] feat: support gts and gjs files --- packages/graphql-tag-pluck/src/config.ts | 6 ++++ packages/graphql-tag-pluck/src/index.ts | 39 +++++++++++++++++++++++- packages/loaders/code-file/src/index.ts | 4 ++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/packages/graphql-tag-pluck/src/config.ts b/packages/graphql-tag-pluck/src/config.ts index 5091aae312b..acdf9d5344d 100644 --- a/packages/graphql-tag-pluck/src/config.ts +++ b/packages/graphql-tag-pluck/src/config.ts @@ -80,6 +80,12 @@ export default function generateConfig( case '.astro': plugins.push('typescript', 'jsx'); break; + case '.gts': + plugins.push('typescript'); + break; + case '.gjs': + plugins.push('jsx'); + break; default: plugins.push('jsx', ...dynamicFlowPlugins); break; diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index 4906097a2d7..a8af897b8e5 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -147,6 +147,8 @@ const supportedExtensions = [ '.vue', '.svelte', '.astro', + '.gts', + '.gjs', ]; // tslint:disable-next-line: no-implicit-dependencies @@ -196,6 +198,12 @@ function parseWithAstroSync( return fileInTsx.code; } +function parseWithGlimmer(glimmerSyntax: typeof import('@glimmer/syntax'), fileData: string) { + const ast = glimmerSyntax.preprocess(fileData); + // You may want to traverse the AST or extract specific elements + return glimmerSyntax.print(ast); +} + /** * Asynchronously plucks GraphQL template literals from a single file. * @@ -238,7 +246,7 @@ export const gqlPluckFromCodeString = async ( /** * Synchronously plucks GraphQL template literals from a single file * - * Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro` + * Supported file extensions include: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mjs`, `.cjs`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`, `.astro`, `.gts`, `.gjs` * * @param filePath Path to the file containing the code. Required to detect the file type * @param code The contents of the file being parsed. @@ -263,6 +271,8 @@ export const gqlPluckFromCodeStringSync = ( code = pluckSvelteFileScriptSync(code); } else if (fileExt === '.astro') { code = pluckAstroFileScriptSync(code); + } else if (fileExt === '.gts' || fileExt === '.gjs') { + code = pluckGlimmerFileScriptSync(code); } const sources = parseCode({ code, filePath, options }).map( @@ -359,6 +369,21 @@ const MissingAstroCompilerError = new Error( `), ); +const MissingGlimmerCompilerError = new Error( + freeText(` + GraphQL template literals cannot be plucked from a Glimmer template code without having the "@glimmer/syntax" package installed. + Please install it and try again. + + Via NPM: + + $ npm install @glimmer/syntax + + Via Yarn: + + $ yarn add @glimmer/syntax + `), +); + async function loadVueCompilerAsync() { try { // eslint-disable-next-line import/no-extraneous-dependencies @@ -445,3 +470,15 @@ function pluckAstroFileScriptSync(fileData: string) { return parseWithAstroSync(astroCompiler, fileData); } + +function pluckGlimmerFileScriptSync(fileData: string) { + let glimmerSyntax: typeof import('@glimmer/syntax'); + try { + // eslint-disable-next-line import/no-extraneous-dependencies + glimmerSyntax = require('@glimmer/syntax'); + } catch { + throw MissingGlimmerCompilerError; + } + + return parseWithGlimmer(glimmerSyntax, fileData); +} diff --git a/packages/loaders/code-file/src/index.ts b/packages/loaders/code-file/src/index.ts index b5cc486a3ed..0fd8f2ac610 100644 --- a/packages/loaders/code-file/src/index.ts +++ b/packages/loaders/code-file/src/index.ts @@ -55,6 +55,8 @@ const FILE_EXTENSIONS = [ '.vue', '.svelte', '.astro', + '.gts', + '.gjs', ]; function createGlobbyOptions(options: CodeFileLoaderOptions): GlobbyOptions { @@ -76,7 +78,7 @@ const buildIgnoreGlob = (path: string) => `!${path}`; * ``` * * Supported extensions include: `.ts`, `.mts`, `.cts`, `.tsx`, `.js`, `.mjs`, - * `.cjs`, `.jsx`, `.vue`, `.svelte`, `.astro` + * `.cjs`, `.jsx`, `.vue`, `.svelte`, `.astro`, `.gts`, `.gjs`. */ export class CodeFileLoader implements Loader { private config: CodeFileLoaderConfig; From c46f4cb8e8c3818a8289d1870733c2f76ee90733 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Tue, 17 Sep 2024 09:40:03 +1000 Subject: [PATCH 03/11] chore: add changeset --- .changeset/thirty-parents-walk.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/thirty-parents-walk.md diff --git a/.changeset/thirty-parents-walk.md b/.changeset/thirty-parents-walk.md new file mode 100644 index 00000000000..a9b44dfba4a --- /dev/null +++ b/.changeset/thirty-parents-walk.md @@ -0,0 +1,6 @@ +--- +'@graphql-tools/graphql-tag-pluck': patch +'@graphql-tools/code-file-loader': patch +--- + +add `.gts` and `.gjs` file support From 77cf59c0fb9282c0a5684467ab3eb104eaacc496 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Tue, 17 Sep 2024 09:47:05 +1000 Subject: [PATCH 04/11] refactor/chore: glimmer package not required, just use @glimmer/syntax --- packages/graphql-tag-pluck/package.json | 1 - yarn.lock | 198 +----------------------- 2 files changed, 7 insertions(+), 192 deletions(-) diff --git a/packages/graphql-tag-pluck/package.json b/packages/graphql-tag-pluck/package.json index 97089354973..04147a9af0b 100644 --- a/packages/graphql-tag-pluck/package.json +++ b/packages/graphql-tag-pluck/package.json @@ -67,7 +67,6 @@ "@types/babel__traverse": "7.20.6", "@vue/compiler-sfc": "3.5.6", "astrojs-compiler-sync": "^1.0.0", - "glint": "^0.0.25", "svelte": "4.2.19", "svelte2tsx": "0.7.19" }, diff --git a/yarn.lock b/yarn.lock index 645502bec42..2d19c4cab69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3531,11 +3531,6 @@ ajv@^8.0.0, ajv@^8.9.0: json-schema-traverse "^1.0.0" require-from-string "^2.0.2" -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - integrity sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg== - ansi-colors@^4.1.1, ansi-colors@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" @@ -3765,21 +3760,11 @@ async-retry@^1.3.3: dependencies: retry "0.13.1" -async@0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.6.tgz#ad3f373d9249ae324881565582bc90e152abbd68" - integrity sha512-LTdAJ0KBRK5o4BlBlUoGvfGNOMON+NLbONgDZk80SX0G8LQZyjN+74nNADIpQ/+rxun6+fYm7z4vIzAB51UKUA== - async@^3.2.3: version "3.2.6" resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== -async@~0.1.22: - version "0.1.22" - resolved "https://registry.yarnpkg.com/async/-/async-0.1.22.tgz#0fc1aaa088a0e3ef0ebe2d8831bab0dcf8845061" - integrity sha512-2tEzliJmf5fHNafNwQLJXUasGzQCVctvsNkXmnlELHwypU0p08/rHohYvkqKIjyXpx+0rkrYv6QbhJ+UF4QkBg== - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -4346,13 +4331,6 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.0.tgz#677de7ed7efff67cc40c9bf1897fea79d41b5215" integrity sha512-N1NGmowPlGBLsOZLPvm48StN04V4YvQRL0i6b7ctrVY3epjP/ct7hFLOItz6pDIvRjwpfPxi52a2UWV2ziir8g== -clean-css@0.10.x: - version "0.10.2" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-0.10.2.tgz#aacdc3332dfe9a75970c73ac4ac7bcbbd09a1d67" - integrity sha512-gBhmkCTMPgrtef2l0BaXZ7CHpS4Ji35pZANpc85xEk7caGoR1CGsek9BHLb06dt+jwDE8Sj1gBsQA7mC0yagEA== - dependencies: - commander "1.1.x" - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -4469,11 +4447,6 @@ colorette@^2.0.20: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== -colors@0.6.0-1: - version "0.6.0-1" - resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.0-1.tgz#6dbb68ceb8bc60f2b313dcc5ce1599f06d19e67a" - integrity sha512-ZaQtySU44lmZRP6M+CovFWnu7QnxLTsr/3wURb7BCOV1/gKjUb/3uu3NsLR+fvA2Jfs6sNfwcVq0Tp2mWYbuxg== - combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -4486,18 +4459,6 @@ comma-separated-tokens@^2.0.0: resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee" integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== -commander@0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-0.6.1.tgz#fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06" - integrity sha512-0fLycpl1UMTGX257hRsu/arL/cUbcvQM4zMKwvLvzXtfdezIV4yotPS2dYtknF+NmEfWSoCEF6+hj9XLm/6hEw== - -commander@1.1.x: - version "1.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-1.1.1.tgz#50d1651868ae60eccff0a2d9f34595376bc6b041" - integrity sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA== - dependencies: - keypress "0.1.x" - commander@7, commander@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" @@ -4762,11 +4723,6 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" -cssom@0.2.x: - version "0.2.5" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.2.5.tgz#2682709b5902e7212df529116ff788cd5b254894" - integrity sha512-b9ecqKEfWrNcyzx5+1nmcfi80fPp8dVM8rlAh7fFK14PZbNjp++gRjyZTZfLJQa/Lw0qeCJho7WBIl0nw0v6HA== - csstype@^3.0.2: version "3.1.3" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" @@ -5127,13 +5083,6 @@ debounce@^1.2.1: resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5" integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== -debug@*, debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.6, debug@^4.3.7, debug@~4.3.6: - version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" - integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== - dependencies: - ms "^2.1.3" - debug@2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -5141,6 +5090,13 @@ debug@2.6.9: dependencies: ms "2.0.0" +debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.6, debug@^4.3.7, debug@~4.3.6: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -6379,16 +6335,6 @@ fs-capacitor@^8.0.0: resolved "https://registry.yarnpkg.com/fs-capacitor/-/fs-capacitor-8.0.0.tgz#a95cbcf58dd50750fe718a03ec051961ef4e61f4" integrity sha512-+Lk6iSKajdGw+7XYxUkwIzreJ2G1JFlYOdnKJv5PzwFLVsoJYBpCuS7WPIUSNT1IbQaEWT1nhYU63Ud03DyzLA== -fs-extra@0.5.x: - version "0.5.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.5.0.tgz#34646dc62c97fa13b1024946bf4174e8c0f05ca4" - integrity sha512-JksTHiXJLXJoHfDNsTjAWUfXD4nOEocEg/fe0dbQK0cPb82bcv64+hm093rwzHvKyDnRnmriP2ajRgnGx7+d2Q== - dependencies: - jsonfile "0.0.x" - mkdirp "0.3.x" - ncp "0.2.x" - rimraf "~2.1.2" - fs-extra@^11.1.0, fs-extra@^11.2.0: version "11.2.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" @@ -6440,14 +6386,6 @@ fs-minipass@^3.0.0: dependencies: minipass "^7.0.3" -fs.notify@0.0.x: - version "0.0.4" - resolved "https://registry.yarnpkg.com/fs.notify/-/fs.notify-0.0.4.tgz#63284d45a34b52ce60088a6ddbec5b776d3c013d" - integrity sha512-xnulkRf31FQwC8NsU5DEYqMTeM3jZpYsTC2hHQcHlkXTubxQHDVWkau13U/oFmFXieCkai2oKTa1MhckXk2fRQ== - dependencies: - async "~0.1.22" - retry "~0.6.0" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -6586,22 +6524,6 @@ github-slugger@^2.0.0: resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-2.0.0.tgz#52cf2f9279a21eb6c59dd385b410f0c0adda8f1a" integrity sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw== -glint@^0.0.25: - version "0.0.25" - resolved "https://registry.yarnpkg.com/glint/-/glint-0.0.25.tgz#fe74ccc1c14c9edfa9c79b50cf9083b2b704eb10" - integrity sha512-gCcGGTlZTzVff7nZLFDd4zkhXTULAJ9/EQgTGvq7LeZareEm0jQhCTHNVYAuKsK3U3A2+NYg9DY4xYFwuZEzbQ== - dependencies: - async "0.2.6" - clean-css "0.10.x" - commander "1.1.x" - fs-extra "0.5.x" - fs.notify "0.0.x" - jade "0.28.x" - nib "0.9.x" - node-sass "0.4.3" - stylus "0.29.x" - uglify-js "2.2.x" - glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -6703,11 +6625,6 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -graceful-fs@~1: - version "1.2.3" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" - integrity sha512-iiTUZ5vZ+2ZV+h71XAgwCSu6+NAizhFU3Yw8aC/hH5SQ3SnISqEqAek40imAFGtDcwJKNhXvSY+hzIolnLwcdQ== - graphemer@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" @@ -7628,14 +7545,6 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -jade@0.28.x: - version "0.28.2" - resolved "https://registry.yarnpkg.com/jade/-/jade-0.28.2.tgz#29ddaafcb42ed6fb7305f8f47379fff70fc77880" - integrity sha512-/u7Gr2BD2KIPl8+91eiuOrgsMOMDXrEzh8VWi60NJXdKTyHYCJTobTKkL8fU8iGvbkPnf9T37YsKVIjQUlcGMw== - dependencies: - commander "0.6.1" - mkdirp "0.3.x" - jake@^10.8.5: version "10.9.2" resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.2.tgz#6ae487e6a69afec3a5e167628996b59f35ae2b7f" @@ -8126,11 +8035,6 @@ jsonc-parser@^3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4" integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ== -jsonfile@0.0.x: - version "0.0.1" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-0.0.1.tgz#b5f9f515121b2844f2cbfe14338b55c79800e1d8" - integrity sha512-exg1z4OyWfLfB05WCTNg+PB8MBSEBnRoRU6MjnE+GXRba1P2wfAvB0ISUWJM2Ve3M6JJlNHBJ4nFXEzjji/4HQ== - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -8159,11 +8063,6 @@ katex@^0.16.0, katex@^0.16.9: dependencies: commander "^8.3.0" -keypress@0.1.x: - version "0.1.0" - resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a" - integrity sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA== - keyv@^4.5.4: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -9563,11 +9462,6 @@ mj-context-menu@^0.6.1: resolved "https://registry.yarnpkg.com/mj-context-menu/-/mj-context-menu-0.6.1.tgz#a043c5282bf7e1cf3821de07b13525ca6f85aa69" integrity sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA== -mkdirp@0.3.x: - version "0.3.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7" - integrity sha512-8OCq0De/h9ZxseqzCH8Kw/Filf5pF/vMI6+BH7Lu0jXz2pqYCjTAQRolSxRIi+Ax+oCCjlxoJMP0YQ4XlrQNHg== - mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -9622,11 +9516,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -ncp@0.2.x: - version "0.2.7" - resolved "https://registry.yarnpkg.com/ncp/-/ncp-0.2.7.tgz#46fac2b7dda2560a4cb7e628677bd5f64eac5be1" - integrity sha512-wPUepcV37u3Mw+ktjrUbl3azxwAkcD9RrVLQGlpSapWcEQM5jL0g8zwKo6ukOjVQAAEjqpRdLeojOalqqySpCg== - negotiator@0.6.3, negotiator@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" @@ -9742,13 +9631,6 @@ nextra@3.0.0-alpha.32: zod "^3.22.3" zod-validation-error "^3.0.0" -nib@0.9.x: - version "0.9.2" - resolved "https://registry.yarnpkg.com/nib/-/nib-0.9.2.tgz#f14570cd0c9a37609b3b662a5e6fc8fb1c6c269e" - integrity sha512-8e1pkjRQSF8+HlwPJUytj+JDsDBuGQh7hnKzpwh4qoIvEol8SuDsCqOgGRL91d4HvfeIiBT9iyDII2gmDmA1Uw== - dependencies: - stylus "0.31.x" - nlcst-to-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/nlcst-to-string/-/nlcst-to-string-4.0.0.tgz#05511e8461ebfb415952eb0b7e9a1a7d40471bd4" @@ -9796,15 +9678,6 @@ node-releases@^2.0.18: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== -node-sass@0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-0.4.3.tgz#2061041cd770f33fecb64929dd81aa9a84e2f1a5" - integrity sha512-7KDytxfSbtUjXXjGCef9soqqD//a17rLs3+vJ2unik1SVnVRu2SABtdZ2mOdBQjlmmgQE1qXg+VYmqKDAGoSEQ== - dependencies: - colors "0.6.0-1" - mkdirp "0.3.x" - optimist "0.3.x" - non-layered-tidy-tree-layout@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz#57d35d13c356643fc296a55fb11ac15e74da7804" @@ -9994,13 +9867,6 @@ optimism@^0.18.0: "@wry/trie" "^0.4.3" tslib "^2.3.0" -optimist@0.3.x, optimist@~0.3.5: - version "0.3.7" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.7.tgz#c90941ad59e4273328923074d2cf2e7cbc6ec0d9" - integrity sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ== - dependencies: - wordwrap "~0.0.2" - optionator@^0.9.3: version "0.9.4" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" @@ -11207,11 +11073,6 @@ retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== -retry@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.6.1.tgz#fdc90eed943fde11b893554b8cc63d0e899ba918" - integrity sha512-txv1qsctZq8ei9J/uCXgaKKFPjlBB0H2hvtnzw9rjKWFNUFtKh59WprXxpAeAey3/QeWwHdxMFqStPaOAgy+dA== - reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -11229,13 +11090,6 @@ rimraf@^2.6.3: dependencies: glob "^7.1.3" -rimraf@~2.1.2: - version "2.1.4" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.1.4.tgz#5a6eb62eeda068f51ede50f29b3e5cd22f3d9bb2" - integrity sha512-tzwmX16YQhcFu0T/m0gHBcFKx6yQAg77Z6WWaQSJsUekXYa6yaAmHhrDdmFicgauX/er7GsdN+vRao3mBhA4kQ== - optionalDependencies: - graceful-fs "~1" - robust-predicates@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.2.tgz#d5b28528c4824d20fc48df1928d41d9efa1ad771" @@ -11647,13 +11501,6 @@ source-map@^0.7.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== -source-map@~0.1.7: - version "0.1.43" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" - integrity sha512-VtCvB9SIQhk3aF6h+N85EaqIaBFIAfZ9Cu+NJHHVvc8BbEcnvDcFw6sqQ2dQrT6SlOrZq3tIvyD9+EGq/lJryQ== - dependencies: - amdefine ">=0.0.4" - space-separated-tokens@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz#1ecd9d2350a3844572c3f4a312bceb018348859f" @@ -11892,24 +11739,6 @@ stylis@^4.1.3: resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.4.tgz#ca5c6c4a35c4784e4e93a2a24dc4e9fa075250a4" integrity sha512-osIBl6BGUmSfDkyH2mB7EFvCJntXDrLhKjHTRj/rK6xLH0yuPrHULDRQzKokSOD4VoorhtKpfcfW1GAntu8now== -stylus@0.29.x: - version "0.29.0" - resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.29.0.tgz#508a8d350a270e23e1900c20ac5604b9a190b611" - integrity sha512-bvhqBONMi+nFyyjONXIs4OJygsxyY/bF6KjYNgz9SUZF7lnJOdBWCNOaXwOkFRcWrAp0vx00dSiwkGt2Muv7Dw== - dependencies: - cssom "0.2.x" - debug "*" - mkdirp "0.3.x" - -stylus@0.31.x: - version "0.31.0" - resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.31.0.tgz#b4f807aa067f071ab707f2c8ae143ab3211e51b2" - integrity sha512-BJ7iU9iUNOj/HlTuUF9SHh994ooIrOr/yYxzzQzpsweulT0HPyL4vtel9/QJcvq+xwy3ff7sf9Nv25kATr2qww== - dependencies: - cssom "0.2.x" - debug "*" - mkdirp "0.3.x" - subscriptions-transport-ws@0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/subscriptions-transport-ws/-/subscriptions-transport-ws-0.11.0.tgz#baf88f050cba51d52afe781de5e81b3c31f89883" @@ -12423,14 +12252,6 @@ ua-parser-js@^1.0.35: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.38.tgz#66bb0c4c0e322fe48edfe6d446df6042e62f25e2" integrity sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ== -uglify-js@2.2.x: - version "2.2.5" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.2.5.tgz#a6e02a70d839792b9780488b7b8b184c095c99c7" - integrity sha512-viLk+/8G0zm2aKt1JJAVcz5J/5ytdiNaIsKgrre3yvSUjwVG6ZUujGH7E2TiPigZUwLYCe7eaIUEP2Zka2VJPA== - dependencies: - optimist "~0.3.5" - source-map "~0.1.7" - uglify-js@^3.1.4: version "3.19.3" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" @@ -12980,11 +12801,6 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - integrity sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw== - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" From b33d3d1a720e2270c3fc71cff0bc273aa00a3cd6 Mon Sep 17 00:00:00 2001 From: DeclanBoller <38486207+DeclanBoller@users.noreply.github.com> Date: Tue, 17 Sep 2024 09:50:18 +1000 Subject: [PATCH 05/11] chore: remove comment --- packages/graphql-tag-pluck/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index a8af897b8e5..aae917790d8 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -200,7 +200,6 @@ function parseWithAstroSync( function parseWithGlimmer(glimmerSyntax: typeof import('@glimmer/syntax'), fileData: string) { const ast = glimmerSyntax.preprocess(fileData); - // You may want to traverse the AST or extract specific elements return glimmerSyntax.print(ast); } From d04ba118e932c3b2e051ba7e1e0a241198961289 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Wed, 18 Sep 2024 09:23:26 +1000 Subject: [PATCH 06/11] refactor: make gts & gjs tests reflect glimmer components more accurately --- packages/graphql-tag-pluck/src/index.ts | 1 - .../tests/graphql-tag-pluck.test.ts | 271 +++++++++++------- 2 files changed, 165 insertions(+), 107 deletions(-) diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index a8af897b8e5..aae917790d8 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -200,7 +200,6 @@ function parseWithAstroSync( function parseWithGlimmer(glimmerSyntax: typeof import('@glimmer/syntax'), fileData: string) { const ast = glimmerSyntax.preprocess(fileData); - // You may want to traverse the AST or extract specific elements return glimmerSyntax.print(ast); } diff --git a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts index 99bb9f6f816..c50eda8e2b7 100644 --- a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts +++ b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts @@ -2398,29 +2398,43 @@ describe('graphql-tag-pluck', () => { const sources = await pluck( 'tmp-XXXXXX.gts', freeText(` - import gql from 'graphql-tag'; + import Component from '@glimmer/component'; + import { graphql } from 'some-graphql-service'; - const query = gql\` - query IndexQuery { - site { - siteMetadata { - title - } + const UpdateCreditCardMutationDocument = graphql(\` + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - \`; + \`); + + + export default class PaymentDetailsPage extends Component { + updateCreditCardMutation = async (): Promise => { + return await new Promise((resolve) => resolve()); + } + + onSubmit = async (): Promise => { + return this.updateCreditCardMutation(); + } - export default class ExampleComponent extends Component {} + + } `), ); expect(sources.map(source => source.body).join('\n\n')).toEqual( freeText(` - query IndexQuery { - site { - siteMetadata { - title - } + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } `), @@ -2431,29 +2445,43 @@ describe('graphql-tag-pluck', () => { const sources = await pluck( 'tmp-XXXXXX.gjs', freeText(` - import gql from 'graphql-tag'; + import Component from '@glimmer/component'; + import { graphql } from 'some-graphql-service'; - const query = gql\` - query IndexQuery { - site { - siteMetadata { - title - } + const UpdateCreditCardMutationDocument = graphql(\` + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - \`; + \`); + + + export default class PaymentDetailsPage extends Component { + updateCreditCardMutation = async (): Promise => { + return await new Promise((resolve) => resolve()); + } - export default class ExampleComponent extends Component {} + onSubmit = async (): Promise => { + return this.updateCreditCardMutation(); + } + + + } `), ); expect(sources.map(source => source.body).join('\n\n')).toEqual( freeText(` - query IndexQuery { - site { - siteMetadata { - title - } + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } `), @@ -2464,100 +2492,119 @@ describe('graphql-tag-pluck', () => { const sources = await pluck( 'tmp-XXXXXX.gts', freeText(` - import gql from 'graphql-tag'; + import Component from '@glimmer/component'; + import { graphql } from 'some-graphql-service'; - const query1 = gql\` - query IndexQuery { - site { - siteMetadata { - title - } + const UpdateCreditCardMutationDocument = graphql(\` + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - \`; + \`); - const query2 = gql\` - query IndexQuery2 { - site { - siteMetadata { - title - } + const UpdatePaypalMutationDocument = graphql(\` + mutation updatePaypal($input: UpdatePaypalInput!) { + updatePaypal(input: $input) { + __typename } } - \`; + \`); - export default class ExampleComponent extends Component {} + + export default class PaymentDetailsPage extends Component { + updateCreditCardMutation = async (): Promise => { + return await new Promise((resolve) => resolve()); + } + + onSubmit = async (): Promise => { + return this.updateCreditCardMutation(); + } + + + } `), ); expect(sources.map(source => source.body).join('\n\n')).toEqual( freeText(` - query IndexQuery { - site { - siteMetadata { - title - } + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - query IndexQuery2 { - site { - siteMetadata { - title - } + mutation updatePaypal($input: UpdatePaypalInput!) { + updatePaypal(input: $input) { + __typename } } `), ); }); - it('should pluck graphql-tag template literals from .gts file with multiple script sections', async () => { + it('should pluck graphql-tag template literals from .gts file with multiple queries in different function signatures', async () => { const sources = await pluck( 'tmp-XXXXXX.gts', freeText(` import Component from '@glimmer/component'; + import { graphql } from 'some-graphql-service'; - const query1 = gql\` - query IndexQuery { - site { - siteMetadata { - title - } + const UpdateCreditCardMutationDocument = graphql(\` + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - \`; + \`); export function anotherQuery() { - const query2 = gql\` - query IndexQuery2 { - site { - siteMetadata { - title - } - } + const UpdatePaypalMutationDocument = graphql(\` + mutation updatePaypal($input: UpdatePaypalInput!) { + updatePaypal(input: $input) { + __typename } - \`; + } + \`); } - export default class ExampleComponent extends Component {} + export default class PaymentDetailsPage extends Component { + updateCreditCardMutation = async (): Promise => { + return await new Promise((resolve) => resolve()); + } + + onSubmit = async (): Promise => { + return this.updateCreditCardMutation(); + } + + + } `), ); expect(sources.map(source => source.body).join('\n\n')).toEqual( freeText(` - query IndexQuery { - site { - siteMetadata { - title - } + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - query IndexQuery2 { - site { - siteMetadata { - title - } + mutation updatePaypal($input: UpdatePaypalInput!) { + updatePaypal(input: $input) { + __typename } } `), @@ -2568,39 +2615,51 @@ describe('graphql-tag-pluck', () => { const sources = await pluck( 'tmp-XXXXXX.gts', freeText(` - import gql from 'graphql-tag'; + import Component from '@glimmer/component'; + import { graphql } from 'some-graphql-service'; - const query = gql\` - query IndexQuery { - site { - siteMetadata { - title - } + const UpdateCreditCardMutationDocument = graphql(\` + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } - \`; - - // const query2 = gql\` - // query IndexQuery2 { - // site { - // siteMetadata { - // title - // } - // } - // } - // \`; - - export default class ExampleComponent extends Component {} + \`); + + // const UpdatePaypalMutationDocument = graphql(\` + // mutation updatePaypal($input: UpdatePaypalInput!) { + // updatePaypal(input: $input) { + // __typename + // } + // } + // \`); + + + export default class PaymentDetailsPage extends Component { + updateCreditCardMutation = async (): Promise => { + return await new Promise((resolve) => resolve()); + } + + onSubmit = async (): Promise => { + return this.updateCreditCardMutation(); + } + + + } `), ); expect(sources.map(source => source.body).join('\n\n')).toEqual( freeText(` - query IndexQuery { - site { - siteMetadata { - title - } + mutation updateCreditCard($input: UpdateCreditCardInput!) { + updateCreditCard(input: $input) { + __typename } } `), From 32237cb6914f5dc282d7fa3c47c178a6098196c5 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Wed, 18 Sep 2024 16:58:44 +1000 Subject: [PATCH 07/11] refactor: use embroider-build/content-tag instead of @glimmer/syntax --- packages/graphql-tag-pluck/package.json | 2 +- packages/graphql-tag-pluck/src/config.ts | 2 +- packages/graphql-tag-pluck/src/index.ts | 32 +++++++--- .../tests/graphql-tag-pluck.test.ts | 23 ++++---- yarn.lock | 59 ++----------------- 5 files changed, 44 insertions(+), 74 deletions(-) diff --git a/packages/graphql-tag-pluck/package.json b/packages/graphql-tag-pluck/package.json index 04147a9af0b..289c9790bb2 100644 --- a/packages/graphql-tag-pluck/package.json +++ b/packages/graphql-tag-pluck/package.json @@ -63,10 +63,10 @@ "@babel/parser": "7.25.6", "@babel/traverse": "7.25.6", "@babel/types": "7.25.6", - "@glimmer/syntax": "^0.92.3", "@types/babel__traverse": "7.20.6", "@vue/compiler-sfc": "3.5.6", "astrojs-compiler-sync": "^1.0.0", + "content-tag": "^2.0.1", "svelte": "4.2.19", "svelte2tsx": "0.7.19" }, diff --git a/packages/graphql-tag-pluck/src/config.ts b/packages/graphql-tag-pluck/src/config.ts index acdf9d5344d..044270fa578 100644 --- a/packages/graphql-tag-pluck/src/config.ts +++ b/packages/graphql-tag-pluck/src/config.ts @@ -84,7 +84,7 @@ export default function generateConfig( plugins.push('typescript'); break; case '.gjs': - plugins.push('jsx'); + plugins.push('typescript', 'jsx'); break; default: plugins.push('jsx', ...dynamicFlowPlugins); diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index aae917790d8..a2dba9ebbc6 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -198,9 +198,11 @@ function parseWithAstroSync( return fileInTsx.code; } -function parseWithGlimmer(glimmerSyntax: typeof import('@glimmer/syntax'), fileData: string) { - const ast = glimmerSyntax.preprocess(fileData); - return glimmerSyntax.print(ast); +// Helper function to handle content-tag transformation +function transformGlimmerFile(glimmerSyntax: typeof import('content-tag'), fileData: string) { + const processor = new glimmerSyntax.Preprocessor(); + const processed = processor.process(fileData); + return processed; } /** @@ -231,6 +233,8 @@ export const gqlPluckFromCodeString = async ( code = await pluckSvelteFileScript(code); } else if (fileExt === '.astro') { code = await pluckAstroFileScript(code); + } else if (fileExt === '.gts' || fileExt === '.gjs') { + code = await pluckGlimmerFileScript(code); } const sources = parseCode({ code, filePath, options }).map( @@ -470,14 +474,28 @@ function pluckAstroFileScriptSync(fileData: string) { return parseWithAstroSync(astroCompiler, fileData); } +async function pluckGlimmerFileScript(fileData: string) { + let contentTag: typeof import('content-tag'); + try { + + contentTag = await import('content-tag'); + } catch { + throw MissingGlimmerCompilerError; + } + + const transformed = transformGlimmerFile(contentTag, fileData); + return transformed; +} + function pluckGlimmerFileScriptSync(fileData: string) { - let glimmerSyntax: typeof import('@glimmer/syntax'); + let contentTag: typeof import('content-tag'); try { - // eslint-disable-next-line import/no-extraneous-dependencies - glimmerSyntax = require('@glimmer/syntax'); + + contentTag = require('content-tag'); } catch { throw MissingGlimmerCompilerError; } - return parseWithGlimmer(glimmerSyntax, fileData); + const transformed = transformGlimmerFile(contentTag, fileData); + return transformed; } diff --git a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts index c50eda8e2b7..3b39e7b2a59 100644 --- a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts +++ b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts @@ -1,3 +1,4 @@ +import { only } from 'node:test'; import { runTests } from '../../testing/utils.js'; import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync } from '../src/index.js'; import { freeText } from '../src/utils.js'; @@ -2399,7 +2400,7 @@ describe('graphql-tag-pluck', () => { 'tmp-XXXXXX.gts', freeText(` import Component from '@glimmer/component'; - import { graphql } from 'some-graphql-service'; + import graphql from 'graphql-tag'; const UpdateCreditCardMutationDocument = graphql(\` mutation updateCreditCard($input: UpdateCreditCardInput!) { @@ -2446,7 +2447,7 @@ describe('graphql-tag-pluck', () => { 'tmp-XXXXXX.gjs', freeText(` import Component from '@glimmer/component'; - import { graphql } from 'some-graphql-service'; + import graphql from 'graphql-tag'; const UpdateCreditCardMutationDocument = graphql(\` mutation updateCreditCard($input: UpdateCreditCardInput!) { @@ -2493,7 +2494,7 @@ describe('graphql-tag-pluck', () => { 'tmp-XXXXXX.gts', freeText(` import Component from '@glimmer/component'; - import { graphql } from 'some-graphql-service'; + import graphql from 'graphql-tag' const UpdateCreditCardMutationDocument = graphql(\` mutation updateCreditCard($input: UpdateCreditCardInput!) { @@ -2540,7 +2541,7 @@ describe('graphql-tag-pluck', () => { } } - mutation updatePaypal($input: UpdatePaypalInput!) { + mutation updatePaypal($input: UpdatePaypalInput!) { updatePaypal(input: $input) { __typename } @@ -2554,7 +2555,7 @@ describe('graphql-tag-pluck', () => { 'tmp-XXXXXX.gts', freeText(` import Component from '@glimmer/component'; - import { graphql } from 'some-graphql-service'; + import graphql from 'graphql-tag' const UpdateCreditCardMutationDocument = graphql(\` mutation updateCreditCard($input: UpdateCreditCardInput!) { @@ -2566,11 +2567,11 @@ describe('graphql-tag-pluck', () => { export function anotherQuery() { const UpdatePaypalMutationDocument = graphql(\` - mutation updatePaypal($input: UpdatePaypalInput!) { - updatePaypal(input: $input) { - __typename + mutation updatePaypal($input: UpdatePaypalInput!) { + updatePaypal(input: $input) { + __typename + } } - } \`); } @@ -2602,7 +2603,7 @@ describe('graphql-tag-pluck', () => { } } - mutation updatePaypal($input: UpdatePaypalInput!) { + mutation updatePaypal($input: UpdatePaypalInput!) { updatePaypal(input: $input) { __typename } @@ -2616,7 +2617,7 @@ describe('graphql-tag-pluck', () => { 'tmp-XXXXXX.gts', freeText(` import Component from '@glimmer/component'; - import { graphql } from 'some-graphql-service'; + import graphql from 'graphql-tag' const UpdateCreditCardMutationDocument = graphql(\` mutation updateCreditCard($input: UpdateCreditCardInput!) { diff --git a/yarn.lock b/yarn.lock index 2d19c4cab69..b45b5d7ebcb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1690,45 +1690,6 @@ dependencies: giscus "^1.5.0" -"@glimmer/env@0.1.7": - version "0.1.7" - resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07" - integrity sha512-JKF/a9I9jw6fGoz8kA7LEQslrwJ5jms5CXhu/aqkBWk+PmZ6pTl8mlb/eJ/5ujBGTiQzBhy5AIWF712iA+4/mw== - -"@glimmer/interfaces@0.92.3": - version "0.92.3" - resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.92.3.tgz#dd2e8d9df59fcebf2fa35a78cc2353738b09d762" - integrity sha512-QwQeA01N+0h+TAi/J7iUnZtRuJy+093hNyagxDQBA6b1wCBw+q+al9+O6gmbWlkWE7EifzmNE1nnrgcecJBlJQ== - dependencies: - "@simple-dom/interface" "^1.4.0" - -"@glimmer/syntax@^0.92.3": - version "0.92.3" - resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.92.3.tgz#0b0923d37469509fcc46243678c7ef8cb41a17de" - integrity sha512-7wPKQmULyXCYf0KvbPmfrs/skPISH2QGR9atCnmDWnHyLv5SSZVLm1P0Ctrpta6+Ci3uGQb7hGk0IjsLEavcYQ== - dependencies: - "@glimmer/interfaces" "0.92.3" - "@glimmer/util" "0.92.3" - "@glimmer/wire-format" "0.92.3" - "@handlebars/parser" "~2.0.0" - simple-html-tokenizer "^0.5.11" - -"@glimmer/util@0.92.3": - version "0.92.3" - resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.92.3.tgz#ac97cf68118d9868b405a2078e3b28603d0ccf57" - integrity sha512-K1oH93gGU36slycxJ9CcFpUTsdOc4XQ6RuZFu5oRsxFYtEF5PSu7ik11h58fyeoaWOr1ebfkyAMawbeI2AJ5GA== - dependencies: - "@glimmer/env" "0.1.7" - "@glimmer/interfaces" "0.92.3" - -"@glimmer/wire-format@0.92.3": - version "0.92.3" - resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.92.3.tgz#0d6d51d657193c806763fa059c0345e6376f461f" - integrity sha512-gFz81Q9+V7Xs0X8mSq6y8qacHm0dPaGJo2/Bfcsdow1hLOKNgTCLr4XeDBhRML8f6I6Gk9ugH4QDxyIOXOpC4w== - dependencies: - "@glimmer/interfaces" "0.92.3" - "@glimmer/util" "0.92.3" - "@graphql-tools/utils@^8.5.2": version "8.13.1" resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.13.1.tgz#b247607e400365c2cd87ff54654d4ad25a7ac491" @@ -1773,11 +1734,6 @@ "@repeaterjs/repeater" "^3.0.4" tslib "^2.5.2" -"@handlebars/parser@~2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-2.0.0.tgz#5e8b7298f31ff8f7b260e6b7363c7e9ceed7d9c5" - integrity sha512-EP9uEDZv/L5Qh9IWuMUGJRfwhXJ4h1dqKTT4/3+tY0eu7sPis7xh23j61SYUnNF4vqCQvvUXpDo9Bh/+q1zASA== - "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -2509,11 +2465,6 @@ resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== -"@simple-dom/interface@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@simple-dom/interface/-/interface-1.4.0.tgz#e8feea579232017f89b0138e2726facda6fbb71f" - integrity sha512-l5qumKFWU0S+4ZzMaLXFU8tQZsicHEMEyAxI5kDFGhJsRqDwe0a7/iPA/GdxlGyDKseQQAgIz5kzU7eXTrlSpA== - "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -4531,6 +4482,11 @@ content-disposition@0.5.4: dependencies: safe-buffer "5.2.1" +content-tag@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/content-tag/-/content-tag-2.0.1.tgz#0b908ed97e13df60b019039713ab63f1b73f2b22" + integrity sha512-jxsETSDs5NbNwyiDuIp672fUMhUyu8Qxc5MOBOJOcgW/fQESI6o5K1LBDrnEE7Bh810a685lWEZHTF4jQYGEEw== + content-type@~1.0.4, content-type@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" @@ -11384,11 +11340,6 @@ signedsource@^1.0.0: resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" integrity sha512-6+eerH9fEnNmi/hyM1DXcRK3pWdoMQtlkQ+ns0ntzunjKqp5i3sKCc80ym8Fib3iaYhdJUOPdhlJWj1tvge2Ww== -simple-html-tokenizer@^0.5.11: - version "0.5.11" - resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.11.tgz#4c5186083c164ba22a7b477b7687ac056ad6b1d9" - integrity sha512-C2WEK/Z3HoSFbYq8tI7ni3eOo/NneSPRoPpcM7WdLjFOArFuyXEjAoCdOC3DgMfRyziZQ1hCNR4mrNdWEvD0og== - sirv@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/sirv/-/sirv-2.0.4.tgz#5dd9a725c578e34e449f332703eb2a74e46a29b0" From ef86853cbb788343ceb45cde721873137f877b8a Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Wed, 18 Sep 2024 17:10:03 +1000 Subject: [PATCH 08/11] fix: lint errors --- packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts index 3b39e7b2a59..1b711e3fcc9 100644 --- a/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts +++ b/packages/graphql-tag-pluck/tests/graphql-tag-pluck.test.ts @@ -1,4 +1,3 @@ -import { only } from 'node:test'; import { runTests } from '../../testing/utils.js'; import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync } from '../src/index.js'; import { freeText } from '../src/utils.js'; From b82aa86cd1717010aa1e0a56efb511d7f1f71c66 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Wed, 18 Sep 2024 17:18:14 +1000 Subject: [PATCH 09/11] chore: why is prettier being difficult --- packages/graphql-tag-pluck/src/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index a2dba9ebbc6..246dfdb011f 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -477,7 +477,6 @@ function pluckAstroFileScriptSync(fileData: string) { async function pluckGlimmerFileScript(fileData: string) { let contentTag: typeof import('content-tag'); try { - contentTag = await import('content-tag'); } catch { throw MissingGlimmerCompilerError; @@ -490,7 +489,6 @@ async function pluckGlimmerFileScript(fileData: string) { function pluckGlimmerFileScriptSync(fileData: string) { let contentTag: typeof import('content-tag'); try { - contentTag = require('content-tag'); } catch { throw MissingGlimmerCompilerError; From 7075097f404ede0377912f970658e9c9b1c2a083 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Thu, 19 Sep 2024 08:59:04 +1000 Subject: [PATCH 10/11] chore: add comment about `gjs` file parsing --- packages/graphql-tag-pluck/src/config.ts | 5 ++++- packages/graphql-tag-pluck/src/index.ts | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/graphql-tag-pluck/src/config.ts b/packages/graphql-tag-pluck/src/config.ts index 044270fa578..f2ecf0cb6d1 100644 --- a/packages/graphql-tag-pluck/src/config.ts +++ b/packages/graphql-tag-pluck/src/config.ts @@ -84,7 +84,10 @@ export default function generateConfig( plugins.push('typescript'); break; case '.gjs': - plugins.push('typescript', 'jsx'); + // .gjs files need to be parsed as TypeScript because Ember relies on decorators, which are handled by TypeScript. + // without this, it throws a SyntaxError: Unexpected token, expected "{" + // when native decorators are supported, we should remove this + plugins.push('typescript'); break; default: plugins.push('jsx', ...dynamicFlowPlugins); diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index 246dfdb011f..430f9c56f47 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -374,16 +374,16 @@ const MissingAstroCompilerError = new Error( const MissingGlimmerCompilerError = new Error( freeText(` - GraphQL template literals cannot be plucked from a Glimmer template code without having the "@glimmer/syntax" package installed. + GraphQL template literals cannot be plucked from a Glimmer template code without having the "content-tag" package installed. Please install it and try again. Via NPM: - $ npm install @glimmer/syntax + $ npm install content-tag Via Yarn: - $ yarn add @glimmer/syntax + $ yarn add content-tag `), ); From 5b80a55df4a764d73f6aae00d7f567c6a4c12d76 Mon Sep 17 00:00:00 2001 From: DeclanBoller Date: Thu, 19 Sep 2024 09:05:52 +1000 Subject: [PATCH 11/11] refactor: make code more succinct and remove redundant comment --- packages/graphql-tag-pluck/src/index.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/graphql-tag-pluck/src/index.ts b/packages/graphql-tag-pluck/src/index.ts index 430f9c56f47..99c85a90097 100644 --- a/packages/graphql-tag-pluck/src/index.ts +++ b/packages/graphql-tag-pluck/src/index.ts @@ -198,11 +198,9 @@ function parseWithAstroSync( return fileInTsx.code; } -// Helper function to handle content-tag transformation function transformGlimmerFile(glimmerSyntax: typeof import('content-tag'), fileData: string) { const processor = new glimmerSyntax.Preprocessor(); - const processed = processor.process(fileData); - return processed; + return processor.process(fileData); } /** @@ -482,8 +480,7 @@ async function pluckGlimmerFileScript(fileData: string) { throw MissingGlimmerCompilerError; } - const transformed = transformGlimmerFile(contentTag, fileData); - return transformed; + return transformGlimmerFile(contentTag, fileData); } function pluckGlimmerFileScriptSync(fileData: string) { @@ -494,6 +491,5 @@ function pluckGlimmerFileScriptSync(fileData: string) { throw MissingGlimmerCompilerError; } - const transformed = transformGlimmerFile(contentTag, fileData); - return transformed; + return transformGlimmerFile(contentTag, fileData); }