@gadgetinc/ggt 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/commands/sync.js +2 -2
- package/lib/commands/sync.js.map +1 -1
- package/lib/services/filesync/filesync.js +3 -1
- package/lib/services/filesync/filesync.js.map +1 -1
- package/lib/services/http/http.js +40 -0
- package/lib/services/http/http.js.map +1 -1
- package/npm-shrinkwrap.json +170 -170
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ With this running in the background, your local `~/gadget/my-app` folder will be
|
|
|
52
52
|
## Usage
|
|
53
53
|
|
|
54
54
|
```sh-session
|
|
55
|
-
$ npm install -g
|
|
55
|
+
$ npm install -g ggt
|
|
56
56
|
$ ggt
|
|
57
57
|
The command-line interface for Gadget
|
|
58
58
|
|
|
@@ -226,5 +226,5 @@ USAGE
|
|
|
226
226
|
|
|
227
227
|
EXAMPLE
|
|
228
228
|
$ ggt version
|
|
229
|
-
0.4.
|
|
229
|
+
0.4.9
|
|
230
230
|
```
|
package/lib/commands/sync.js
CHANGED
|
@@ -243,8 +243,8 @@ export const args = {
|
|
|
243
243
|
ggt v${config.version}
|
|
244
244
|
|
|
245
245
|
App ${filesync.app.slug}
|
|
246
|
-
Editor https://${filesync.app.
|
|
247
|
-
Playground https://${filesync.app.
|
|
246
|
+
Editor https://${filesync.app.primaryDomain}/edit
|
|
247
|
+
Playground https://${filesync.app.primaryDomain}/api/graphql/playground
|
|
248
248
|
Docs https://docs.gadget.dev/api/${filesync.app.slug}
|
|
249
249
|
|
|
250
250
|
Endpoints ${filesync.app.hasSplitEnvironments ? `
|
package/lib/commands/sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/sync.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport ms from \"ms\";\nimport path from \"node:path\";\nimport Watcher from \"watcher\";\nimport which from \"which\";\nimport type { ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { config } from \"../services/config/config.js\";\nimport { Changes } from \"../services/filesync/changes.js\";\nimport { YarnNotFoundError } from \"../services/filesync/error.js\";\nimport { FileSync, FileSyncArgs } from \"../services/filesync/filesync.js\";\nimport { notify } from \"../services/output/notify.js\";\nimport { reportErrorAndExit } from \"../services/output/report.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { debounce } from \"../services/util/function.js\";\nimport { isAbortError } from \"../services/util/is.js\";\n\nexport const usage: Usage = () => sprint`\n Sync your Gadget environment's source code with your local filesystem.\n\n {bold USAGE}\n ggt sync [DIRECTORY]\n\n {bold ARGUMENTS}\n DIRECTORY The directory to sync files to (default: \".\")\n\n {bold FLAGS}\n -a, --app=<name> The Gadget application to sync files to\n --prefer=<filesystem> Prefer \"local\" or \"gadget\" conflicting changes\n --once Sync once and exit\n --force Sync regardless of local filesystem state\n\n {bold DESCRIPTION}\n Sync allows you to synchronize your Gadget application's source\n code with your local filesystem.\n\n While ggt sync is running, local file changes are immediately\n reflected within Gadget, while files that are changed in Gadget are\n immediately saved to your local filesystem.\n\n Ideal for:\n • Local development with editors like VSCode\n • Storing source code in a Git repository like GitHub\n\n Sync looks for a \".ignore\" file to exclude certain files/directories\n from being synced. The format is identical to Git's.\n\n These files are always ignored:\n • .DS_Store\n • .gadget\n • .git\n • node_modules\n\n Note:\n • Sync only works with your development environment\n • Avoid deleting/moving all your files while sync is running\n • Gadget only supports Yarn v1 for dependency installation\n\n {bold EXAMPLE}\n $ ggt sync ~/gadget/example --app example\n\n App example\n Editor https://example.gadget.app/edit\n Playground https://example.gadget.app/api/graphql/playground\n Docs https://docs.gadget.dev/api/example\n\n Endpoints\n • https://example.gadget.app\n • https://example--development.gadget.app\n\n Watching for file changes... {gray Press Ctrl+C to stop}\n\n → Sent {gray 09:06:25 AM}\n {greenBright routes/GET-hello.js + created}\n\n → Sent {gray 09:06:49 AM}\n {blueBright routes/GET-hello.js ± updated}\n\n ← Received {gray 09:06:54 AM}\n {blueBright routes/GET-hello.js ± updated}\n\n ← Received {gray 09:06:56 AM}\n {redBright routes/GET-hello.js - deleted}\n ^C Stopping... {gray press Ctrl+C again to force}\n\n Goodbye!\n`;\n\nexport const args = {\n ...FileSyncArgs,\n \"--once\": Boolean,\n \"--file-push-delay\": { type: Number, default: ms(\"100ms\") },\n \"--file-watch-debounce\": { type: Number, default: ms(\"300ms\") },\n \"--file-watch-poll-interval\": { type: Number, default: ms(\"3s\") },\n \"--file-watch-poll-timeout\": { type: Number, default: ms(\"20s\") },\n \"--file-watch-rename-timeout\": { type: Number, default: ms(\"1.25s\") },\n} satisfies ArgsDefinition;\n\nexport type SyncArgs = typeof args;\n\n/**\n * Runs the sync process until it is stopped or an error occurs.\n */\nexport const command: Command<SyncArgs> = async (ctx) => {\n if (!which.sync(\"yarn\", { nothrow: true })) {\n throw new YarnNotFoundError();\n }\n\n const filesync = await FileSync.init(ctx);\n await filesync.sync();\n\n if (ctx.args[\"--once\"]) {\n ctx.log.println(\"Done!\");\n return;\n }\n\n /**\n * A list of filepaths that have changed because we (this ggt process)\n * modified them. This is used to avoid reacting to filesystem events\n * that we caused, which would cause an infinite loop.\n */\n const recentWritesToLocalFilesystem = new Map<string, number>();\n\n const clearRecentWritesInterval = setInterval(() => {\n for (const [path, timestamp] of recentWritesToLocalFilesystem) {\n if (dayjs().isAfter(timestamp + ms(\"5s\"))) {\n // this change should have been seen by now\n recentWritesToLocalFilesystem.delete(path);\n }\n }\n }, ms(\"1s\")).unref();\n\n /**\n * Subscribe to file changes on Gadget and apply them to the local\n * filesystem.\n */\n const unsubscribeFromGadgetChanges = filesync.subscribeToGadgetChanges({\n onError: (error) => ctx.abort(error),\n beforeChanges: ({ changed, deleted }) => {\n // add all the files and directories we're about to touch to\n // recentWritesToLocalFilesystem so that we don't send them back\n // to Gadget\n for (const filepath of [...changed, ...deleted]) {\n recentWritesToLocalFilesystem.set(filepath, Date.now());\n\n let dir = path.dirname(filepath);\n while (dir !== \".\") {\n recentWritesToLocalFilesystem.set(dir + \"/\", Date.now());\n dir = path.dirname(dir);\n }\n }\n },\n });\n\n /**\n * A buffer of local file changes to send to Gadget.\n */\n const localChangesBuffer = new Changes();\n\n /**\n * A debounced function that sends the local file changes to Gadget.\n */\n const sendChangesToGadget = debounce(ctx.args[\"--file-push-delay\"], () => {\n const changes = new Changes(localChangesBuffer.entries());\n localChangesBuffer.clear();\n filesync.sendChangesToGadget({ changes }).catch((error) => ctx.abort(error));\n });\n\n ctx.log.debug(\"watching\", { path: filesync.directory.path });\n\n /**\n * Watches the local filesystem for changes.\n */\n const fileWatcher = new Watcher(\n filesync.directory.path,\n {\n // don't emit an event for every watched file on boot\n ignoreInitial: true,\n // don't emit changes to .gadget/ files because they're readonly (Gadget manages them)\n ignore: (path: string) => filesync.directory.relative(path).startsWith(\".gadget\") || filesync.directory.ignores(path),\n renameDetection: true,\n recursive: true,\n debounce: ctx.args[\"--file-watch-debounce\"],\n pollingInterval: ctx.args[\"--file-watch-poll-interval\"],\n pollingTimeout: ctx.args[\"--file-watch-poll-timeout\"],\n renameTimeout: ctx.args[\"--file-watch-rename-timeout\"],\n },\n (event: string, absolutePath: string, renamedPath: string) => {\n const filepath = event === \"rename\" || event === \"renameDir\" ? renamedPath : absolutePath;\n const isDirectory = event === \"renameDir\" || event === \"addDir\" || event === \"unlinkDir\";\n const normalizedPath = filesync.directory.normalize(filepath, isDirectory);\n\n ctx.log.trace(\"file event\", { event, isDirectory, path: normalizedPath });\n\n if (filepath === filesync.directory.absolute(\".ignore\")) {\n filesync.directory.loadIgnoreFile().catch((error) => ctx.abort(error));\n } else if (filesync.directory.ignores(filepath)) {\n return;\n }\n\n if (recentWritesToLocalFilesystem.delete(normalizedPath)) {\n ctx.log.trace(\"ignoring event because we caused it\", { event, path: normalizedPath });\n return;\n }\n\n switch (event) {\n case \"add\":\n case \"addDir\":\n localChangesBuffer.set(normalizedPath, { type: \"create\" });\n break;\n case \"rename\":\n case \"renameDir\": {\n const oldNormalizedPath = filesync.directory.normalize(absolutePath, isDirectory);\n localChangesBuffer.set(normalizedPath, { type: \"create\", oldPath: oldNormalizedPath });\n break;\n }\n case \"change\": {\n localChangesBuffer.set(normalizedPath, { type: \"update\" });\n break;\n }\n case \"unlink\":\n case \"unlinkDir\": {\n localChangesBuffer.set(normalizedPath, { type: \"delete\" });\n break;\n }\n }\n\n sendChangesToGadget();\n },\n ).once(\"error\", (error) => ctx.abort(error));\n\n ctx.log.printlns`\n ggt v${config.version}\n\n App ${filesync.app.slug}\n Editor https://${filesync.app.slug}.gadget.app/edit\n Playground https://${filesync.app.slug}.gadget.app/api/graphql/playground\n Docs https://docs.gadget.dev/api/${filesync.app.slug}\n\n Endpoints ${\n filesync.app.hasSplitEnvironments\n ? `\n • https://${filesync.app.primaryDomain}\n • https://${filesync.app.slug}--development.gadget.app`\n : `\n • https://${filesync.app.primaryDomain}`\n }\n\n Watching for file changes... {gray Press Ctrl+C to stop}\n `;\n\n ctx.onAbort(async (reason) => {\n ctx.log.info(\"stopping\", { reason });\n\n unsubscribeFromGadgetChanges();\n fileWatcher.close();\n clearInterval(clearRecentWritesInterval);\n sendChangesToGadget.flush();\n\n try {\n await filesync.idle();\n } catch (error) {\n ctx.log.error(\"error while waiting for idle\", { error });\n }\n\n if (isAbortError(reason)) {\n ctx.log.printlns(\"Goodbye!\");\n return;\n }\n\n notify(ctx, { subtitle: \"Uh oh!\", message: \"An error occurred while syncing files\" });\n await reportErrorAndExit(ctx, reason);\n });\n};\n"],"names":["dayjs","ms","path","Watcher","which","config","Changes","YarnNotFoundError","FileSync","FileSyncArgs","notify","reportErrorAndExit","sprint","debounce","isAbortError","usage","args","Boolean","type","Number","default","command","ctx","sync","nothrow","filesync","init","log","println","recentWritesToLocalFilesystem","Map","clearRecentWritesInterval","setInterval","timestamp","isAfter","delete","unref","unsubscribeFromGadgetChanges","subscribeToGadgetChanges","onError","error","abort","beforeChanges","changed","deleted","filepath","set","Date","now","dir","dirname","localChangesBuffer","sendChangesToGadget","changes","entries","clear","catch","debug","directory","fileWatcher","ignoreInitial","ignore","relative","startsWith","ignores","renameDetection","recursive","pollingInterval","pollingTimeout","renameTimeout","event","absolutePath","renamedPath","isDirectory","normalizedPath","normalize","trace","absolute","loadIgnoreFile","oldNormalizedPath","oldPath","once","printlns","version","app","slug","hasSplitEnvironments","primaryDomain","onAbort","reason","info","close","clearInterval","flush","idle","subtitle","message"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,UAAU,YAAY;AAC7B,OAAOC,aAAa,UAAU;AAC9B,OAAOC,WAAW,QAAQ;AAG1B,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,QAAQ,EAAEC,YAAY,QAAQ,mCAAmC;AAC1E,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,OAAO,MAAMC,QAAe,IAAMH,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEzC,CAAC,CAAC;AAEF,OAAO,MAAMI,OAAO;IAClB,GAAGP,YAAY;IACf,UAAUQ;IACV,qBAAqB;QAAEC,MAAMC;QAAQC,SAASnB,GAAG;IAAS;IAC1D,yBAAyB;QAAEiB,MAAMC;QAAQC,SAASnB,GAAG;IAAS;IAC9D,8BAA8B;QAAEiB,MAAMC;QAAQC,SAASnB,GAAG;IAAM;IAChE,6BAA6B;QAAEiB,MAAMC;QAAQC,SAASnB,GAAG;IAAO;IAChE,+BAA+B;QAAEiB,MAAMC;QAA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D,GAAG,CAACG,aAAa,CAAC,CAAC,CACzC;;;EAGH,CAAC;IAEDjE,IAAIkE,OAAO,CAAC,OAAOC;QACjBnE,IAAIK,GAAG,CAAC+D,IAAI,CAAC,YAAY;YAAED;QAAO;QAElCpD;QACAsB,YAAYgC,KAAK;QACjBC,cAAc7D;QACdqB,oBAAoByC,KAAK;QAEzB,IAAI;YACF,MAAMpE,SAASqE,IAAI;QACrB,EAAE,OAAOtD,OAAO;YACdlB,IAAIK,GAAG,CAACa,KAAK,CAAC,gCAAgC;gBAAEA;YAAM;QACxD;QAEA,IAAI1B,aAAa2E,SAAS;YACxBnE,IAAIK,GAAG,CAACuD,QAAQ,CAAC;YACjB;QACF;QAEAxE,OAAOY,KAAK;YAAEyE,UAAU;YAAUC,SAAS;QAAwC;QACnF,MAAMrF,mBAAmBW,KAAKmE;IAChC;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/sync.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport ms from \"ms\";\nimport path from \"node:path\";\nimport Watcher from \"watcher\";\nimport which from \"which\";\nimport type { ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { config } from \"../services/config/config.js\";\nimport { Changes } from \"../services/filesync/changes.js\";\nimport { YarnNotFoundError } from \"../services/filesync/error.js\";\nimport { FileSync, FileSyncArgs } from \"../services/filesync/filesync.js\";\nimport { notify } from \"../services/output/notify.js\";\nimport { reportErrorAndExit } from \"../services/output/report.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { debounce } from \"../services/util/function.js\";\nimport { isAbortError } from \"../services/util/is.js\";\n\nexport const usage: Usage = () => sprint`\n Sync your Gadget environment's source code with your local filesystem.\n\n {bold USAGE}\n ggt sync [DIRECTORY]\n\n {bold ARGUMENTS}\n DIRECTORY The directory to sync files to (default: \".\")\n\n {bold FLAGS}\n -a, --app=<name> The Gadget application to sync files to\n --prefer=<filesystem> Prefer \"local\" or \"gadget\" conflicting changes\n --once Sync once and exit\n --force Sync regardless of local filesystem state\n\n {bold DESCRIPTION}\n Sync allows you to synchronize your Gadget application's source\n code with your local filesystem.\n\n While ggt sync is running, local file changes are immediately\n reflected within Gadget, while files that are changed in Gadget are\n immediately saved to your local filesystem.\n\n Ideal for:\n • Local development with editors like VSCode\n • Storing source code in a Git repository like GitHub\n\n Sync looks for a \".ignore\" file to exclude certain files/directories\n from being synced. The format is identical to Git's.\n\n These files are always ignored:\n • .DS_Store\n • .gadget\n • .git\n • node_modules\n\n Note:\n • Sync only works with your development environment\n • Avoid deleting/moving all your files while sync is running\n • Gadget only supports Yarn v1 for dependency installation\n\n {bold EXAMPLE}\n $ ggt sync ~/gadget/example --app example\n\n App example\n Editor https://example.gadget.app/edit\n Playground https://example.gadget.app/api/graphql/playground\n Docs https://docs.gadget.dev/api/example\n\n Endpoints\n • https://example.gadget.app\n • https://example--development.gadget.app\n\n Watching for file changes... {gray Press Ctrl+C to stop}\n\n → Sent {gray 09:06:25 AM}\n {greenBright routes/GET-hello.js + created}\n\n → Sent {gray 09:06:49 AM}\n {blueBright routes/GET-hello.js ± updated}\n\n ← Received {gray 09:06:54 AM}\n {blueBright routes/GET-hello.js ± updated}\n\n ← Received {gray 09:06:56 AM}\n {redBright routes/GET-hello.js - deleted}\n ^C Stopping... {gray press Ctrl+C again to force}\n\n Goodbye!\n`;\n\nexport const args = {\n ...FileSyncArgs,\n \"--once\": Boolean,\n \"--file-push-delay\": { type: Number, default: ms(\"100ms\") },\n \"--file-watch-debounce\": { type: Number, default: ms(\"300ms\") },\n \"--file-watch-poll-interval\": { type: Number, default: ms(\"3s\") },\n \"--file-watch-poll-timeout\": { type: Number, default: ms(\"20s\") },\n \"--file-watch-rename-timeout\": { type: Number, default: ms(\"1.25s\") },\n} satisfies ArgsDefinition;\n\nexport type SyncArgs = typeof args;\n\n/**\n * Runs the sync process until it is stopped or an error occurs.\n */\nexport const command: Command<SyncArgs> = async (ctx) => {\n if (!which.sync(\"yarn\", { nothrow: true })) {\n throw new YarnNotFoundError();\n }\n\n const filesync = await FileSync.init(ctx);\n await filesync.sync();\n\n if (ctx.args[\"--once\"]) {\n ctx.log.println(\"Done!\");\n return;\n }\n\n /**\n * A list of filepaths that have changed because we (this ggt process)\n * modified them. This is used to avoid reacting to filesystem events\n * that we caused, which would cause an infinite loop.\n */\n const recentWritesToLocalFilesystem = new Map<string, number>();\n\n const clearRecentWritesInterval = setInterval(() => {\n for (const [path, timestamp] of recentWritesToLocalFilesystem) {\n if (dayjs().isAfter(timestamp + ms(\"5s\"))) {\n // this change should have been seen by now\n recentWritesToLocalFilesystem.delete(path);\n }\n }\n }, ms(\"1s\")).unref();\n\n /**\n * Subscribe to file changes on Gadget and apply them to the local\n * filesystem.\n */\n const unsubscribeFromGadgetChanges = filesync.subscribeToGadgetChanges({\n onError: (error) => ctx.abort(error),\n beforeChanges: ({ changed, deleted }) => {\n // add all the files and directories we're about to touch to\n // recentWritesToLocalFilesystem so that we don't send them back\n // to Gadget\n for (const filepath of [...changed, ...deleted]) {\n recentWritesToLocalFilesystem.set(filepath, Date.now());\n\n let dir = path.dirname(filepath);\n while (dir !== \".\") {\n recentWritesToLocalFilesystem.set(dir + \"/\", Date.now());\n dir = path.dirname(dir);\n }\n }\n },\n });\n\n /**\n * A buffer of local file changes to send to Gadget.\n */\n const localChangesBuffer = new Changes();\n\n /**\n * A debounced function that sends the local file changes to Gadget.\n */\n const sendChangesToGadget = debounce(ctx.args[\"--file-push-delay\"], () => {\n const changes = new Changes(localChangesBuffer.entries());\n localChangesBuffer.clear();\n filesync.sendChangesToGadget({ changes }).catch((error) => ctx.abort(error));\n });\n\n ctx.log.debug(\"watching\", { path: filesync.directory.path });\n\n /**\n * Watches the local filesystem for changes.\n */\n const fileWatcher = new Watcher(\n filesync.directory.path,\n {\n // don't emit an event for every watched file on boot\n ignoreInitial: true,\n // don't emit changes to .gadget/ files because they're readonly (Gadget manages them)\n ignore: (path: string) => filesync.directory.relative(path).startsWith(\".gadget\") || filesync.directory.ignores(path),\n renameDetection: true,\n recursive: true,\n debounce: ctx.args[\"--file-watch-debounce\"],\n pollingInterval: ctx.args[\"--file-watch-poll-interval\"],\n pollingTimeout: ctx.args[\"--file-watch-poll-timeout\"],\n renameTimeout: ctx.args[\"--file-watch-rename-timeout\"],\n },\n (event: string, absolutePath: string, renamedPath: string) => {\n const filepath = event === \"rename\" || event === \"renameDir\" ? renamedPath : absolutePath;\n const isDirectory = event === \"renameDir\" || event === \"addDir\" || event === \"unlinkDir\";\n const normalizedPath = filesync.directory.normalize(filepath, isDirectory);\n\n ctx.log.trace(\"file event\", { event, isDirectory, path: normalizedPath });\n\n if (filepath === filesync.directory.absolute(\".ignore\")) {\n filesync.directory.loadIgnoreFile().catch((error) => ctx.abort(error));\n } else if (filesync.directory.ignores(filepath)) {\n return;\n }\n\n if (recentWritesToLocalFilesystem.delete(normalizedPath)) {\n ctx.log.trace(\"ignoring event because we caused it\", { event, path: normalizedPath });\n return;\n }\n\n switch (event) {\n case \"add\":\n case \"addDir\":\n localChangesBuffer.set(normalizedPath, { type: \"create\" });\n break;\n case \"rename\":\n case \"renameDir\": {\n const oldNormalizedPath = filesync.directory.normalize(absolutePath, isDirectory);\n localChangesBuffer.set(normalizedPath, { type: \"create\", oldPath: oldNormalizedPath });\n break;\n }\n case \"change\": {\n localChangesBuffer.set(normalizedPath, { type: \"update\" });\n break;\n }\n case \"unlink\":\n case \"unlinkDir\": {\n localChangesBuffer.set(normalizedPath, { type: \"delete\" });\n break;\n }\n }\n\n sendChangesToGadget();\n },\n ).once(\"error\", (error) => ctx.abort(error));\n\n ctx.log.printlns`\n ggt v${config.version}\n\n App ${filesync.app.slug}\n Editor https://${filesync.app.primaryDomain}/edit\n Playground https://${filesync.app.primaryDomain}/api/graphql/playground\n Docs https://docs.gadget.dev/api/${filesync.app.slug}\n\n Endpoints ${\n filesync.app.hasSplitEnvironments\n ? `\n • https://${filesync.app.primaryDomain}\n • https://${filesync.app.slug}--development.gadget.app`\n : `\n • https://${filesync.app.primaryDomain}`\n }\n\n Watching for file changes... {gray Press Ctrl+C to stop}\n `;\n\n ctx.onAbort(async (reason) => {\n ctx.log.info(\"stopping\", { reason });\n\n unsubscribeFromGadgetChanges();\n fileWatcher.close();\n clearInterval(clearRecentWritesInterval);\n sendChangesToGadget.flush();\n\n try {\n await filesync.idle();\n } catch (error) {\n ctx.log.error(\"error while waiting for idle\", { error });\n }\n\n if (isAbortError(reason)) {\n ctx.log.printlns(\"Goodbye!\");\n return;\n }\n\n notify(ctx, { subtitle: \"Uh oh!\", message: \"An error occurred while syncing files\" });\n await reportErrorAndExit(ctx, reason);\n });\n};\n"],"names":["dayjs","ms","path","Watcher","which","config","Changes","YarnNotFoundError","FileSync","FileSyncArgs","notify","reportErrorAndExit","sprint","debounce","isAbortError","usage","args","Boolean","type","Number","default","command","ctx","sync","nothrow","filesync","init","log","println","recentWritesToLocalFilesystem","Map","clearRecentWritesInterval","setInterval","timestamp","isAfter","delete","unref","unsubscribeFromGadgetChanges","subscribeToGadgetChanges","onError","error","abort","beforeChanges","changed","deleted","filepath","set","Date","now","dir","dirname","localChangesBuffer","sendChangesToGadget","changes","entries","clear","catch","debug","directory","fileWatcher","ignoreInitial","ignore","relative","startsWith","ignores","renameDetection","recursive","pollingInterval","pollingTimeout","renameTimeout","event","absolutePath","renamedPath","isDirectory","normalizedPath","normalize","trace","absolute","loadIgnoreFile","oldNormalizedPath","oldPath","once","printlns","version","app","slug","primaryDomain","hasSplitEnvironments","onAbort","reason","info","close","clearInterval","flush","idle","subtitle","message"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,UAAU,YAAY;AAC7B,OAAOC,aAAa,UAAU;AAC9B,OAAOC,WAAW,QAAQ;AAG1B,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,Q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571,9 @@ export class FileSync {
|
|
|
571
571
|
swallowEnoent(error);
|
|
572
572
|
}
|
|
573
573
|
}, {
|
|
574
|
-
|
|
574
|
+
// windows tends to run into these issues way more often than
|
|
575
|
+
// mac/linux, so we retry more times
|
|
576
|
+
retries: config.windows ? 4 : 2,
|
|
575
577
|
minTimeout: ms("100ms"),
|
|
576
578
|
onFailedAttempt: (error)=>{
|
|
577
579
|
this.ctx.log.warn("failed to move file to backup", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/filesync/filesync.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport { execa } from \"execa\";\nimport { findUp } from \"find-up\";\nimport fs from \"fs-extra\";\nimport ms from \"ms\";\nimport assert from \"node:assert\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport pMap from \"p-map\";\nimport PQueue from \"p-queue\";\nimport pRetry from \"p-retry\";\nimport type { Promisable } from \"type-fest\";\nimport { z } from \"zod\";\nimport { FileSyncEncoding, type FileSyncChangedEventInput, type FileSyncDeletedEventInput } from \"../../__generated__/graphql.js\";\nimport type { App } from \"../app/app.js\";\nimport { getApps } from \"../app/app.js\";\nimport { AppArg } from \"../app/arg.js\";\nimport { Edit } from \"../app/edit/edit.js\";\nimport { EditError } from \"../app/edit/error.js\";\nimport {\n FILE_SYNC_COMPARISON_HASHES_QUERY,\n FILE_SYNC_FILES_QUERY,\n FILE_SYNC_HASHES_QUERY,\n PUBLISH_FILE_SYNC_EVENTS_MUTATION,\n REMOTE_FILE_SYNC_EVENTS_SUBSCRIPTION,\n} from \"../app/edit/operation.js\";\nimport { ArgError, type ArgsDefinition } from \"../command/arg.js\";\nimport type { Context } from \"../command/context.js\";\nimport { config, homePath } from \"../config/config.js\";\nimport { select } from \"../output/prompt.js\";\nimport { sprint } from \"../output/sprint.js\";\nimport { getUserOrLogin } from \"../user/user.js\";\nimport { sortBySimilar } from \"../util/collection.js\";\nimport { noop } from \"../util/function.js\";\nimport { isGraphQLErrors, isGraphQLResult, isObject, isString } from \"../util/is.js\";\nimport { Changes, printChanges } from \"./changes.js\";\nimport { getConflicts, printConflicts, withoutConflictingChanges } from \"./conflicts.js\";\nimport { Directory, supportsPermissions, swallowEnoent, type Hashes } from \"./directory.js\";\nimport { InvalidSyncFileError, TooManySyncAttemptsError } from \"./error.js\";\nimport type { File } from \"./file.js\";\nimport { getChanges, isEqualHashes, type ChangesWithHash } from \"./hashes.js\";\n\nexport type FileSyncHashes = {\n inSync: boolean;\n filesVersionHashes: Hashes;\n localHashes: Hashes;\n gadgetHashes: Hashes;\n gadgetFilesVersion: bigint;\n};\n\nexport class FileSync {\n readonly edit: Edit;\n\n /**\n * A FIFO async callback queue that ensures we process filesync events\n * in the order we receive them.\n */\n private _syncOperations = new PQueue({ concurrency: 1 });\n\n private constructor(\n /**\n * The {@linkcode Context} that was used to initialize this\n * {@linkcode FileSync} instance.\n */\n readonly ctx: Context<FileSyncArgs>,\n\n /**\n * The directory that is being synced to.\n */\n readonly directory: Directory,\n\n /**\n * The Gadget application that is being synced to.\n */\n readonly app: App,\n\n /**\n * The state of the filesystem.\n *\n * This is persisted to `.gadget/sync.json` within the {@linkcode directory}.\n */\n private _syncJson: { app: string; filesVersion: string; mtime: number },\n ) {\n this.ctx = ctx.child({ fields: () => ({ filesync: { directory: this.directory.path, filesVersion: this.filesVersion } }) });\n this.edit = new Edit(this.ctx);\n }\n\n /**\n * The last filesVersion that was written to the filesystem.\n *\n * This determines if the filesystem in Gadget is ahead of the\n * filesystem on the local machine.\n */\n get filesVersion(): bigint {\n return BigInt(this._syncJson.filesVersion);\n }\n\n /**\n * The largest mtime that was seen on the filesystem.\n *\n * This is used to determine if any files have changed since the last\n * sync. This does not include the mtime of files that are ignored.\n */\n get mtime(): number {\n return this._syncJson.mtime;\n }\n\n /**\n * Initializes a {@linkcode FileSync} instance.\n * - Ensures the directory exists.\n * - Ensures the directory is empty or contains a `.gadget/sync.json` file (unless `options.force` is `true`)\n * - Ensures an app is specified (either via `options.app` or by prompting the user)\n * - Ensures the specified app matches the app the directory was previously synced to (unless `options.force` is `true`)\n */\n static async init(ctx: Context<FileSyncArgs>): Promise<FileSync> {\n ctx = ctx.child({ name: \"filesync\" });\n\n const user = await getUserOrLogin(ctx);\n const apps = await getApps(ctx);\n if (apps.length === 0) {\n throw new ArgError(\n sprint`\n You (${user.email}) don't have have any Gadget applications.\n\n Visit https://gadget.new to create one!\n `,\n );\n }\n\n let dir = ctx.args._[0];\n if (!dir) {\n // the user didn't specify a directory\n const filepath = await findUp(\".gadget/sync.json\");\n if (filepath) {\n // we found a .gadget/sync.json file, use its parent directory\n dir = path.join(filepath, \"../..\");\n } else {\n // we didn't find a .gadget/sync.json file, use the current directory\n dir = process.cwd();\n }\n }\n\n if (config.windows && dir.startsWith(\"~/\")) {\n // `~` doesn't expand to the home directory on Windows\n dir = homePath(dir.slice(2));\n }\n\n // ensure the root directory is an absolute path and exists\n const wasEmptyOrNonExistent = await isEmptyOrNonExistentDir(dir);\n await fs.ensureDir((dir = path.resolve(dir)));\n\n // try to load the .gadget/sync.json file\n const state = await fs\n .readJson(path.join(dir, \".gadget/sync.json\"))\n .then((json) =>\n z\n .object({\n app: z.string(),\n filesVersion: z.string(),\n mtime: z.number(),\n })\n .parse(json),\n )\n .catch(noop);\n\n let appSlug = ctx.args[\"--app\"] || state?.app;\n if (!appSlug) {\n // the user didn't specify an app, suggest some apps that they can sync to\n appSlug = await select(ctx, {\n message: \"Select the app to sync to\",\n choices: apps.map((x) => x.slug),\n });\n }\n\n // try to find the appSlug in their list of apps\n const app = apps.find((app) => app.slug === appSlug);\n if (!app) {\n // the specified appSlug doesn't exist in their list of apps,\n // either they misspelled it or they don't have access to it\n // anymore, suggest some apps that are similar to the one they\n // specified\n const similarAppSlugs = sortBySimilar(\n appSlug,\n apps.map((app) => app.slug),\n ).slice(0, 5);\n\n throw new ArgError(\n sprint`\n Unknown application:\n\n ${appSlug}\n\n Did you mean one of these?\n\n\n `.concat(` • ${similarAppSlugs.join(\"\\n • \")}`),\n );\n }\n\n ctx.app = app;\n const directory = await Directory.init(dir);\n\n if (!state) {\n // the .gadget/sync.json file didn't exist or contained invalid json\n if (wasEmptyOrNonExistent || ctx.args[\"--force\"]) {\n // the directory was empty or the user passed --force\n // either way, create a fresh .gadget/sync.json file\n return new FileSync(ctx, directory, app, { app: app.slug, filesVersion: \"0\", mtime: 0 });\n }\n\n // the directory isn't empty and the user didn't pass --force\n throw new InvalidSyncFileError(dir, app.slug);\n }\n\n // the .gadget/sync.json file exists\n if (state.app === app.slug) {\n // the .gadget/sync.json file is for the same app that the user specified\n return new FileSync(ctx, directory, app, state);\n }\n\n // the .gadget/sync.json file is for a different app\n if (ctx.args[\"--force\"]) {\n // the user passed --force, so use the app they specified and overwrite everything\n return new FileSync(ctx, directory, app, { app: app.slug, filesVersion: \"0\", mtime: 0 });\n }\n\n // the user didn't pass --force, so throw an error\n throw new ArgError(sprint`\n You were about to sync the following app to the following directory:\n\n {dim ${app.slug}} → {dim ${dir}}\n\n However, that directory has already been synced with this app:\n\n {dim ${state.app}}\n\n If you're sure that you want to sync:\n\n {dim ${app.slug}} → {dim ${dir}}\n\n Then run {dim ggt sync} again with the {dim --force} flag.\n `);\n }\n\n /**\n * Waits for all pending and ongoing filesync operations to complete.\n */\n async idle(): Promise<void> {\n await this._syncOperations.onIdle();\n }\n\n /**\n * Sends file changes to the Gadget.\n *\n * @param options - The options to use.\n * @param options.changes - The changes to send.\n * @returns A promise that resolves when the changes have been sent.\n */\n async sendChangesToGadget({ changes }: { changes: Changes }): Promise<void> {\n await this._syncOperations.add(async () => {\n try {\n await this._sendChangesToGadget({ changes });\n } catch (error) {\n swallowFilesVersionMismatch(this.ctx, error);\n // we either sent the wrong expectedFilesVersion or we received\n // a filesVersion that is greater than the expectedFilesVersion\n // + 1, so we need to stop what we're doing and get in sync\n await this.sync();\n }\n });\n }\n\n /**\n * Subscribes to file changes on Gadget and executes the provided\n * callbacks before and after the changes occur.\n *\n * @param options - The options to use.\n * @param options.beforeChanges - A callback that is called before the changes occur.\n * @param options.afterChanges - A callback that is called after the changes occur.\n * @param options.onError - A callback that is called if an error occurs.\n * @returns A function that unsubscribes from changes on Gadget.\n */\n subscribeToGadgetChanges({\n beforeChanges = noop,\n afterChanges = noop,\n onError,\n }: {\n beforeChanges?: (data: { changed: string[]; deleted: string[] }) => Promisable<void>;\n afterChanges?: (data: { changes: Changes }) => Promisable<void>;\n onError: (error: unknown) => void;\n }): () => void {\n return this.edit.subscribe({\n subscription: REMOTE_FILE_SYNC_EVENTS_SUBSCRIPTION,\n // the reason this is a function rather than a static value is\n // so that it will be re-evaluated if the connection is lost and\n // then re-established. this ensures that we send our current\n // filesVersion rather than the one that was sent when we first\n // subscribed\n variables: () => ({ localFilesVersion: String(this.filesVersion) }),\n onError,\n onData: ({ remoteFileSyncEvents: { changed, deleted, remoteFilesVersion } }) => {\n this._syncOperations\n .add(async () => {\n if (BigInt(remoteFilesVersion) < this.filesVersion) {\n this.ctx.log.warn(\"skipping received changes because files version is outdated\", { filesVersion: remoteFilesVersion });\n return;\n }\n\n this.ctx.log.debug(\"received files\", {\n remoteFilesVersion,\n changed: changed.map((change) => change.path),\n deleted: deleted.map((change) => change.path),\n });\n\n const filterIgnoredFiles = (file: { path: string }): boolean => {\n const ignored = this.directory.ignores(file.path);\n if (ignored) {\n this.ctx.log.warn(\"skipping received change because file is ignored\", { path: file.path });\n }\n return !ignored;\n };\n\n changed = changed.filter(filterIgnoredFiles);\n deleted = deleted.filter(filterIgnoredFiles);\n\n if (changed.length === 0 && deleted.length === 0) {\n await this._save(remoteFilesVersion);\n return;\n }\n\n await beforeChanges({\n changed: changed.map((file) => file.path),\n deleted: deleted.map((file) => file.path),\n });\n\n const changes = await this._writeToLocalFilesystem({\n filesVersion: remoteFilesVersion,\n files: changed,\n delete: deleted.map((file) => file.path),\n });\n\n if (changes.size > 0) {\n printChanges(this.ctx, {\n message: sprint`← Received {gray ${dayjs().format(\"hh:mm:ss A\")}}`,\n changes,\n tense: \"past\",\n limit: 10,\n });\n }\n\n await afterChanges({ changes });\n })\n .catch(onError);\n },\n });\n }\n\n /**\n * Ensures the local filesystem is in sync with Gadget's filesystem.\n * - All non-conflicting changes are automatically merged.\n * - Conflicts are resolved by prompting the user to either keep their local changes or keep Gadget's changes.\n * - This function will not return until the filesystem is in sync.\n */\n async sync({ maxAttempts = 10 }: { maxAttempts?: number } = {}): Promise<void> {\n let attempt = 0;\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition\n while (true) {\n const { inSync, ...hashes } = await this.hashes();\n\n if (inSync) {\n this._syncOperations.clear();\n this.ctx.log.info(\"filesystem is in sync\", { attempt });\n await this._save(hashes.gadgetFilesVersion);\n return;\n }\n\n if (attempt++ >= maxAttempts) {\n throw new TooManySyncAttemptsError(maxAttempts);\n }\n\n try {\n this.ctx.log.info(\"syncing\", { attempt, ...hashes });\n await this._sync(hashes);\n } catch (error) {\n swallowFilesVersionMismatch(this.ctx, error);\n // we either sent the wrong expectedFilesVersion or we received\n // a filesVersion that is greater than the expectedFilesVersion\n // + 1, so try again\n }\n }\n }\n\n async _sync({ filesVersionHashes, localHashes, gadgetHashes, gadgetFilesVersion }: Omit<FileSyncHashes, \"inSync\">): Promise<void> {\n let localChanges = getChanges(this.ctx, { from: filesVersionHashes, to: localHashes, existing: gadgetHashes, ignore: [\".gadget/\"] });\n let gadgetChanges = getChanges(this.ctx, { from: filesVersionHashes, to: gadgetHashes, existing: localHashes });\n\n if (localChanges.size === 0 && gadgetChanges.size === 0) {\n // the local filesystem is missing .gadget/ files\n gadgetChanges = getChanges(this.ctx, { from: localHashes, to: gadgetHashes });\n assertAllGadgetFiles({ gadgetChanges });\n }\n\n assert(localChanges.size > 0 || gadgetChanges.size > 0, \"there must be changes if hashes don't match\");\n\n const conflicts = getConflicts({ localChanges, gadgetChanges });\n if (conflicts.size > 0) {\n this.ctx.log.debug(\"conflicts detected\", { conflicts });\n\n let preference = this.ctx.args[\"--prefer\"];\n if (!preference) {\n printConflicts(this.ctx, {\n message: sprint`{bold You have conflicting changes with Gadget}`,\n conflicts,\n });\n\n preference = await select(this.ctx, {\n message: \"How would you like to resolve these conflicts?\",\n choices: Object.values(ConflictPreference),\n });\n }\n\n switch (preference) {\n case ConflictPreference.CANCEL: {\n process.exit(0);\n break;\n }\n case ConflictPreference.LOCAL: {\n gadgetChanges = withoutConflictingChanges({ conflicts, changes: gadgetChanges });\n break;\n }\n case ConflictPreference.GADGET: {\n localChanges = withoutConflictingChanges({ conflicts, changes: localChanges });\n break;\n }\n }\n }\n\n if (gadgetChanges.size > 0) {\n await this._getChangesFromGadget({ changes: gadgetChanges, filesVersion: gadgetFilesVersion });\n }\n\n if (localChanges.size > 0) {\n await this._sendChangesToGadget({ changes: localChanges, expectedFilesVersion: gadgetFilesVersion });\n }\n }\n\n async hashes(): Promise<FileSyncHashes> {\n const [localHashes, { filesVersionHashes, gadgetHashes, gadgetFilesVersion }] = await Promise.all([\n // get the hashes of our local files\n this.directory.hashes(),\n // get the hashes of our local filesVersion and the latest filesVersion\n (async () => {\n let gadgetFilesVersion: bigint;\n let gadgetHashes: Hashes;\n let filesVersionHashes: Hashes;\n\n if (this.filesVersion === 0n) {\n // this is the first time we're syncing, so just get the\n // hashes of the latest filesVersion\n const { fileSyncHashes } = await this.edit.query({ query: FILE_SYNC_HASHES_QUERY });\n gadgetFilesVersion = BigInt(fileSyncHashes.filesVersion);\n gadgetHashes = fileSyncHashes.hashes;\n filesVersionHashes = {};\n } else {\n // this isn't the first time we're syncing, so get the hashes\n // of the files at our local filesVersion and the latest\n // filesVersion\n const { fileSyncComparisonHashes } = await this.edit.query({\n query: FILE_SYNC_COMPARISON_HASHES_QUERY,\n variables: { filesVersion: String(this.filesVersion) },\n });\n gadgetFilesVersion = BigInt(fileSyncComparisonHashes.latestFilesVersionHashes.filesVersion);\n gadgetHashes = fileSyncComparisonHashes.latestFilesVersionHashes.hashes;\n filesVersionHashes = fileSyncComparisonHashes.filesVersionHashes.hashes;\n }\n\n return { filesVersionHashes, gadgetHashes, gadgetFilesVersion };\n })(),\n ]);\n\n return {\n filesVersionHashes,\n localHashes,\n gadgetHashes,\n gadgetFilesVersion,\n inSync: isEqualHashes(this.ctx, localHashes, gadgetHashes),\n };\n }\n\n private async _getChangesFromGadget({\n filesVersion,\n changes,\n }: {\n filesVersion: bigint;\n changes: Changes | ChangesWithHash;\n }): Promise<void> {\n this.ctx.log.debug(\"getting changes from gadget\", { filesVersion, changes });\n const created = changes.created();\n const updated = changes.updated();\n\n let files: File[] = [];\n if (created.length > 0 || updated.length > 0) {\n const { fileSyncFiles } = await this.edit.query({\n query: FILE_SYNC_FILES_QUERY,\n variables: {\n paths: [...created, ...updated],\n filesVersion: String(filesVersion),\n encoding: FileSyncEncoding.Base64,\n },\n });\n\n files = fileSyncFiles.files;\n }\n\n await this._writeToLocalFilesystem({\n filesVersion,\n files,\n delete: changes.deleted(),\n });\n\n printChanges(this.ctx, {\n changes,\n tense: \"past\",\n message: sprint`← Received {gray ${dayjs().format(\"hh:mm:ss A\")}}`,\n });\n }\n\n private async _sendChangesToGadget({\n expectedFilesVersion = this.filesVersion,\n changes,\n printLimit,\n }: {\n expectedFilesVersion?: bigint;\n changes: Changes;\n printLimit?: number;\n }): Promise<void> {\n this.ctx.log.debug(\"sending changes to gadget\", { expectedFilesVersion, changes });\n const changed: FileSyncChangedEventInput[] = [];\n const deleted: FileSyncDeletedEventInput[] = [];\n\n await pMap(changes, async ([normalizedPath, change]) => {\n if (change.type === \"delete\") {\n deleted.push({ path: normalizedPath });\n return;\n }\n\n const absolutePath = this.directory.absolute(normalizedPath);\n\n let stats;\n try {\n stats = await fs.stat(absolutePath);\n } catch (error) {\n swallowEnoent(error);\n this.ctx.log.debug(\"skipping change because file doesn't exist\", { path: normalizedPath });\n return;\n }\n\n let content = \"\";\n if (stats.isFile()) {\n content = await fs.readFile(absolutePath, FileSyncEncoding.Base64);\n }\n\n let oldPath;\n if (change.type === \"create\" && change.oldPath) {\n oldPath = change.oldPath;\n }\n\n changed.push({\n content,\n oldPath,\n path: normalizedPath,\n mode: stats.mode,\n encoding: FileSyncEncoding.Base64,\n });\n });\n\n if (changed.length === 0 && deleted.length === 0) {\n this.ctx.log.debug(\"skipping send because there are no changes\");\n return;\n }\n\n const {\n publishFileSyncEvents: { remoteFilesVersion },\n } = await this.edit.mutate({\n mutation: PUBLISH_FILE_SYNC_EVENTS_MUTATION,\n variables: {\n input: {\n expectedRemoteFilesVersion: String(expectedFilesVersion),\n changed,\n deleted,\n },\n },\n http: {\n retry: {\n // we can retry this request because\n // expectedRemoteFilesVersion makes it idempotent\n methods: [\"POST\"],\n calculateDelay: ({ error, computedValue }) => {\n if (isFilesVersionMismatchError(error.response?.body)) {\n // don't retry if we get a files version mismatch error\n return 0;\n }\n return computedValue;\n },\n },\n },\n });\n\n printChanges(this.ctx, {\n changes,\n tense: \"past\",\n message: sprint`→ Sent {gray ${dayjs().format(\"hh:mm:ss A\")}}`,\n limit: printLimit,\n });\n\n if (BigInt(remoteFilesVersion) > expectedFilesVersion + 1n) {\n // we can't save the remoteFilesVersion because we haven't\n // received the intermediate filesVersions yet\n throw new Error(\"Files version mismatch\");\n }\n\n await this._save(remoteFilesVersion);\n }\n\n private async _writeToLocalFilesystem(options: { filesVersion: bigint | string; files: File[]; delete: string[] }): Promise<Changes> {\n const filesVersion = BigInt(options.filesVersion);\n assert(filesVersion >= this.filesVersion, \"filesVersion must be greater than or equal to current filesVersion\");\n\n this.ctx.log.debug(\"writing to local filesystem\", {\n filesVersion,\n files: options.files.map((file) => file.path),\n delete: options.delete,\n });\n\n const created: string[] = [];\n const updated: string[] = [];\n\n await pMap(options.delete, async (filepath) => {\n const currentPath = this.directory.absolute(filepath);\n const backupPath = this.directory.absolute(\".gadget/backup\", this.directory.relative(filepath));\n\n // rather than `rm -rf`ing files, we move them to\n // `.gadget/backup/` so that users can recover them if something\n // goes wrong. We've seen a lot of EBUSY/EINVAL errors when moving\n // files so we retry a few times.\n await pRetry(\n async () => {\n try {\n // remove the current backup file in case it exists and is a\n // different type (file vs directory)\n await fs.remove(backupPath);\n await fs.move(currentPath, backupPath);\n } catch (error) {\n // replicate the behavior of `rm -rf` and ignore ENOENT\n swallowEnoent(error);\n }\n },\n {\n retries: 2,\n minTimeout: ms(\"100ms\"),\n onFailedAttempt: (error) => {\n this.ctx.log.warn(\"failed to move file to backup\", { error, currentPath, backupPath });\n },\n },\n );\n });\n\n await pMap(options.files, async (file) => {\n const absolutePath = this.directory.absolute(file.path);\n if (await fs.pathExists(absolutePath)) {\n updated.push(file.path);\n } else {\n created.push(file.path);\n }\n\n if (file.path.endsWith(\"/\")) {\n await fs.ensureDir(absolutePath);\n } else {\n await fs.outputFile(absolutePath, Buffer.from(file.content, file.encoding));\n }\n\n if (supportsPermissions) {\n // the os's default umask makes setting the mode during creation\n // not work, so an additional fs.chmod call is necessary to\n // ensure the file has the correct mode\n await fs.chmod(absolutePath, file.mode & 0o777);\n }\n\n if (absolutePath === this.directory.absolute(\".ignore\")) {\n await this.directory.loadIgnoreFile();\n }\n });\n\n await this._save(String(filesVersion));\n\n const changes = new Changes([\n ...created.map((path) => [path, { type: \"create\" }] as const),\n ...updated.map((path) => [path, { type: \"update\" }] as const),\n ...options.delete.map((path) => [path, { type: \"delete\" }] as const),\n ]);\n\n if (changes.has(\"yarn.lock\")) {\n this.ctx.log.info(\"running yarn install --check-files\");\n await execa(\"yarn\", [\"install\", \"--check-files\"], { cwd: this.directory.path })\n .then(() => this.ctx.log.info(\"yarn install complete\"))\n .catch((error: unknown) => this.ctx.log.error(\"yarn install failed\", { error }));\n }\n\n return changes;\n }\n\n /**\n * Updates {@linkcode _syncJson} and saves it to `.gadget/sync.json`.\n */\n private async _save(filesVersion: string | bigint): Promise<void> {\n this._syncJson = { ...this._syncJson, mtime: Date.now() + 1, filesVersion: String(filesVersion) };\n this.ctx.log.debug(\"saving .gadget/sync.json\");\n await fs.outputJSON(this.directory.absolute(\".gadget/sync.json\"), this._syncJson, { spaces: 2 });\n }\n}\n\n/**\n * Checks if a directory is empty or non-existent.\n *\n * @param dir - The directory path to check.\n * @returns A Promise that resolves to a boolean indicating whether the directory is empty or non-existent.\n */\nexport const isEmptyOrNonExistentDir = async (dir: string): Promise<boolean> => {\n try {\n for await (const _ of await fs.opendir(dir, { bufferSize: 1 })) {\n return false;\n }\n return true;\n } catch (error) {\n swallowEnoent(error);\n return true;\n }\n};\n\nexport const assertAllGadgetFiles = ({ gadgetChanges }: { gadgetChanges: Changes }): void => {\n assert(\n gadgetChanges.created().length > 0 || gadgetChanges.deleted().length > 0 || gadgetChanges.updated().length > 0,\n \"expected gadgetChanges to have changes\",\n );\n\n const allGadgetFiles = Array.from(gadgetChanges.keys()).every((path) => path.startsWith(\".gadget/\"));\n assert(allGadgetFiles, \"expected all gadgetChanges to be .gadget/ files\");\n};\n\nexport const ConflictPreference = Object.freeze({\n CANCEL: \"Cancel (Ctrl+C)\",\n LOCAL: \"Keep my conflicting changes\",\n GADGET: \"Keep Gadget's conflicting changes\",\n});\n\nexport type ConflictPreference = (typeof ConflictPreference)[keyof typeof ConflictPreference];\n\nexport const ConflictPreferenceArg = (value: string, name: string): ConflictPreference => {\n if ([\"local\", \"gadget\"].includes(value)) {\n return ConflictPreference[value.toUpperCase() as keyof typeof ConflictPreference];\n }\n\n throw new ArgError(sprint`\n ${name} must be {bold local} or {bold gadget}\n\n {bold EXAMPLES:}\n ${name} local\n ${name} gadget\n `);\n};\n\nexport const FileSyncArgs = {\n \"--app\": { type: AppArg, alias: \"-a\" },\n \"--prefer\": ConflictPreferenceArg,\n \"--force\": Boolean,\n} satisfies ArgsDefinition;\n\nexport type FileSyncArgs = typeof FileSyncArgs;\n\nexport const isFilesVersionMismatchError = (error: unknown): boolean => {\n if (error instanceof EditError) {\n error = error.cause;\n }\n if (isGraphQLResult(error)) {\n error = error.errors;\n }\n if (isGraphQLErrors(error)) {\n error = error[0];\n }\n return isObject(error) && \"message\" in error && isString(error.message) && error.message.startsWith(\"Files version mismatch\");\n};\n\nconst swallowFilesVersionMismatch = (ctx: Context, error: unknown): void => {\n if (isFilesVersionMismatchError(error)) {\n ctx.log.debug(\"swallowing files version mismatch\", { error });\n return;\n }\n throw error;\n};\n"],"names":["dayjs","execa","findUp","fs","ms","assert","path","process","pMap","PQueue","pRetry","z","FileSyncEncoding","getApps","AppArg","Edit","EditError","FILE_SYNC_COMPARISON_HASHES_QUERY","FILE_SYNC_FILES_QUERY","FILE_SYNC_HASHES_QUERY","PUBLISH_FILE_SYNC_EVENTS_MUTATION","REMOTE_FILE_SYNC_EVENTS_SUBSCRIPTION","ArgError","config","homePath","select","sprint","getUserOrLogin","sortBySimilar","noop","isGraphQLErrors","isGraphQLResult","isObject","isString","Changes","printChanges","getConflicts","printConflicts","withoutConflictingChanges","Directory","supportsPermissions","swallowEnoent","InvalidSyncFileError","TooManySyncAttemptsError","getChanges","isEqualHashes","FileSync","filesVersion","BigInt","_syncJson","mtime","init","ctx","child","name","user","apps","length","email","dir","args","_","filepath","join","cwd","windows","startsWith","slice","wasEmptyOrNonExistent","isEmptyOrNonExistentDir","ensureDir","resolve","state","readJson","then","json","object","app","string","number","parse","catch","appSlug","message","choices","map","x","slug","find","similarAppSlugs","concat","directory","idle","_syncOperations","onIdle","sendChangesToGadget","changes","add","_sendChangesToGadget","error","swallowFilesVersionMismatch","sync","subscribeToGadgetChanges","beforeChanges","afterChanges","onError","edit","subscribe","subscription","variables","localFilesVersion","String","onData","remoteFileSyncEvents","changed","deleted","remoteFilesVersion","log","warn","debug","change","filterIgnoredFiles","file","ignored","ignores","filter","_save","_writeToLocalFilesystem","files","delete","size","format","tense","limit","maxAttempts","attempt","inSync","hashes","clear","info","gadgetFilesVersion","_sync","filesVersionHashes","localHashes","gadgetHashes","localChanges","from","to","existing","ignore","gadgetChanges","assertAllGadgetFiles","conflicts","preference","Object","values","ConflictPreference","CANCEL","exit","LOCAL","GADGET","_getChangesFromGadget","expectedFilesVersion","Promise","all","fileSyncHashes","query","fileSyncComparisonHashes","latestFilesVersionHashes","created","updated","fileSyncFiles","paths","encoding","Base64","printLimit","normalizedPath","type","push","absolutePath","absolute","stats","stat","content","isFile","readFile","oldPath","mode","publishFileSyncEvents","mutate","mutation","input","expectedRemoteFilesVersion","http","retry","methods","calculateDelay","computedValue","isFilesVersionMismatchError","response","body","Error","options","currentPath","backupPath","relative","remove","move","retries","minTimeout","onFailedAttempt","pathExists","endsWith","outputFile","Buffer","chmod","loadIgnoreFile","has","Date","now","outputJSON","spaces","concurrency","fields","filesync","opendir","bufferSize","allGadgetFiles","Array","keys","every","freeze","ConflictPreferenceArg","value","includes","toUpperCase","FileSyncArgs","alias","Boolean","cause","errors"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,KAAK,QAAQ,QAAQ;AAC9B,SAASC,MAAM,QAAQ,UAAU;AACjC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,cAAc;AACjC,OAAOC,UAAU,YAAY;AAC7B,OAAOC,aAAa,eAAe;AACnC,OAAOC,UAAU,QAAQ;AACzB,OAAOC,YAAY,UAAU;AAC7B,OAAOC,YAAY,UAAU;AAE7B,SAASC,CAAC,QAAQ,MAAM;AACxB,SAASC,gBAAgB,QAAwE,iCAAiC;AAElI,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACEC,iCAAiC,EACjCC,qBAAqB,EACrBC,sBAAsB,EACtBC,iCAAiC,EACjCC,oCAAoC,QAC/B,2BAA2B;AAClC,SAASC,QAAQ,QAA6B,oBAAoB;AAElE,SAASC,MAAM,EAAEC,QAAQ,QAAQ,sBAAsB;AACvD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,cAAc,QAAQ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;AAEF,MAAMkC,8BAA8B,CAAChD,KAAc+C;IACjD,IAAImG,4BAA4BnG,QAAQ;QACtC/C,IAAIiE,GAAG,CAACE,KAAK,CAAC,qCAAqC;YAAEpB;QAAM;QAC3D;IACF;IACA,MAAMA;AACR"}
|
|
1
|
+
{"version":3,"sources":["../../../src/services/filesync/filesync.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport { execa } from \"execa\";\nimport { findUp } from \"find-up\";\nimport fs from \"fs-extra\";\nimport ms from \"ms\";\nimport assert from \"node:assert\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport pMap from \"p-map\";\nimport PQueue from \"p-queue\";\nimport pRetry from \"p-retry\";\nimport type { Promisable } from \"type-fest\";\nimport { z } from \"zod\";\nimport { FileSyncEncoding, type FileSyncChangedEventInput, type FileSyncDeletedEventInput } from \"../../__generated__/graphql.js\";\nimport type { App } from \"../app/app.js\";\nimport { getApps } from \"../app/app.js\";\nimport { AppArg } from \"../app/arg.js\";\nimport { Edit } from \"../app/edit/edit.js\";\nimport { EditError } from \"../app/edit/error.js\";\nimport {\n FILE_SYNC_COMPARISON_HASHES_QUERY,\n FILE_SYNC_FILES_QUERY,\n FILE_SYNC_HASHES_QUERY,\n PUBLISH_FILE_SYNC_EVENTS_MUTATION,\n REMOTE_FILE_SYNC_EVENTS_SUBSCRIPTION,\n} from \"../app/edit/operation.js\";\nimport { ArgError, type ArgsDefinition } from \"../command/arg.js\";\nimport type { Context } from \"../command/context.js\";\nimport { config, homePath } from \"../config/config.js\";\nimport { select } from \"../output/prompt.js\";\nimport { sprint } from \"../output/sprint.js\";\nimport { getUserOrLogin } from \"../user/user.js\";\nimport { sortBySimilar } from \"../util/collection.js\";\nimport { noop } from \"../util/function.js\";\nimport { isGraphQLErrors, isGraphQLResult, isObject, isString } from \"../util/is.js\";\nimport { Changes, printChanges } from \"./changes.js\";\nimport { getConflicts, printConflicts, withoutConflictingChanges } from \"./conflicts.js\";\nimport { Directory, supportsPermissions, swallowEnoent, type Hashes } from \"./directory.js\";\nimport { InvalidSyncFileError, TooManySyncAttemptsError } from \"./error.js\";\nimport type { File } from \"./file.js\";\nimport { getChanges, isEqualHashes, type ChangesWithHash } from \"./hashes.js\";\n\nexport type FileSyncHashes = {\n inSync: boolean;\n filesVersionHashes: Hashes;\n localHashes: Hashes;\n gadgetHashes: Hashes;\n gadgetFilesVersion: bigint;\n};\n\nexport class FileSync {\n readonly edit: Edit;\n\n /**\n * A FIFO async callback queue that ensures we process filesync events\n * in the order we receive them.\n */\n private _syncOperations = new PQueue({ concurrency: 1 });\n\n private constructor(\n /**\n * The {@linkcode Context} that was used to initialize this\n * {@linkcode FileSync} instance.\n */\n readonly ctx: Context<FileSyncArgs>,\n\n /**\n * The directory that is being synced to.\n */\n readonly directory: Directory,\n\n /**\n * The Gadget application that is being synced to.\n */\n readonly app: App,\n\n /**\n * The state of the filesystem.\n *\n * This is persisted to `.gadget/sync.json` within the {@linkcode directory}.\n */\n private _syncJson: { app: string; filesVersion: string; mtime: number },\n ) {\n this.ctx = ctx.child({ fields: () => ({ filesync: { directory: this.directory.path, filesVersion: this.filesVersion } }) });\n this.edit = new Edit(this.ctx);\n }\n\n /**\n * The last filesVersion that was written to the filesystem.\n *\n * This determines if the filesystem in Gadget is ahead of the\n * filesystem on the local machine.\n */\n get filesVersion(): bigint {\n return BigInt(this._syncJson.filesVersion);\n }\n\n /**\n * The largest mtime that was seen on the filesystem.\n *\n * This is used to determine if any files have changed since the last\n * sync. This does not include the mtime of files that are ignored.\n */\n get mtime(): number {\n return this._syncJson.mtime;\n }\n\n /**\n * Initializes a {@linkcode FileSync} instance.\n * - Ensures the directory exists.\n * - Ensures the directory is empty or contains a `.gadget/sync.json` file (unless `options.force` is `true`)\n * - Ensures an app is specified (either via `options.app` or by prompting the user)\n * - Ensures the specified app matches the app the directory was previously synced to (unless `options.force` is `true`)\n */\n static async init(ctx: Context<FileSyncArgs>): Promise<FileSync> {\n ctx = ctx.child({ name: \"filesync\" });\n\n const user = await getUserOrLogin(ctx);\n const apps = await getApps(ctx);\n if (apps.length === 0) {\n throw new ArgError(\n sprint`\n You (${user.email}) don't have have any Gadget applications.\n\n Visit https://gadget.new to create one!\n `,\n );\n }\n\n let dir = ctx.args._[0];\n if (!dir) {\n // the user didn't specify a directory\n const filepath = await findUp(\".gadget/sync.json\");\n if (filepath) {\n // we found a .gadget/sync.json file, use its parent directory\n dir = path.join(filepath, \"../..\");\n } else {\n // we didn't find a .gadget/sync.json file, use the current directory\n dir = process.cwd();\n }\n }\n\n if (config.windows && dir.startsWith(\"~/\")) {\n // `~` doesn't expand to the home directory on Windows\n dir = homePath(dir.slice(2));\n }\n\n // ensure the root directory is an absolute path and exists\n const wasEmptyOrNonExistent = await isEmptyOrNonExistentDir(dir);\n await fs.ensureDir((dir = path.resolve(dir)));\n\n // try to load the .gadget/sync.json file\n const state = await fs\n .readJson(path.join(dir, \".gadget/sync.json\"))\n .then((json) =>\n z\n .object({\n app: z.string(),\n filesVersion: z.string(),\n mtime: z.number(),\n })\n .parse(json),\n )\n .catch(noop);\n\n let appSlug = ctx.args[\"--app\"] || state?.app;\n if (!appSlug) {\n // the user didn't specify an app, suggest some apps that they can sync to\n appSlug = await select(ctx, {\n message: \"Select the app to sync to\",\n choices: apps.map((x) => x.slug),\n });\n }\n\n // try to find the appSlug in their list of apps\n const app = apps.find((app) => app.slug === appSlug);\n if (!app) {\n // the specified appSlug doesn't exist in their list of apps,\n // either they misspelled it or they don't have access to it\n // anymore, suggest some apps that are similar to the one they\n // specified\n const similarAppSlugs = sortBySimilar(\n appSlug,\n apps.map((app) => app.slug),\n ).slice(0, 5);\n\n throw new ArgError(\n sprint`\n Unknown application:\n\n ${appSlug}\n\n Did you mean one of these?\n\n\n `.concat(` • ${similarAppSlugs.join(\"\\n • \")}`),\n );\n }\n\n ctx.app = app;\n const directory = await Directory.init(dir);\n\n if (!state) {\n // the .gadget/sync.json file didn't exist or contained invalid json\n if (wasEmptyOrNonExistent || ctx.args[\"--force\"]) {\n // the directory was empty or the user passed --force\n // either way, create a fresh .gadget/sync.json file\n return new FileSync(ctx, directory, app, { app: app.slug, filesVersion: \"0\", mtime: 0 });\n }\n\n // the directory isn't empty and the user didn't pass --force\n throw new InvalidSyncFileError(dir, app.slug);\n }\n\n // the .gadget/sync.json file exists\n if (state.app === app.slug) {\n // the .gadget/sync.json file is for the same app that the user specified\n return new FileSync(ctx, directory, app, state);\n }\n\n // the .gadget/sync.json file is for a different app\n if (ctx.args[\"--force\"]) {\n // the user passed --force, so use the app they specified and overwrite everything\n return new FileSync(ctx, directory, app, { app: app.slug, filesVersion: \"0\", mtime: 0 });\n }\n\n // the user didn't pass --force, so throw an error\n throw new ArgError(sprint`\n You were about to sync the following app to the following directory:\n\n {dim ${app.slug}} → {dim ${dir}}\n\n However, that directory has already been synced with this app:\n\n {dim ${state.app}}\n\n If you're sure that you want to sync:\n\n {dim ${app.slug}} → {dim ${dir}}\n\n Then run {dim ggt sync} again with the {dim --force} flag.\n `);\n }\n\n /**\n * Waits for all pending and ongoing filesync operations to complete.\n */\n async idle(): Promise<void> {\n await this._syncOperations.onIdle();\n }\n\n /**\n * Sends file changes to the Gadget.\n *\n * @param options - The options to use.\n * @param options.changes - The changes to send.\n * @returns A promise that resolves when the changes have been sent.\n */\n async sendChangesToGadget({ changes }: { changes: Changes }): Promise<void> {\n await this._syncOperations.add(async () => {\n try {\n await this._sendChangesToGadget({ changes });\n } catch (error) {\n swallowFilesVersionMismatch(this.ctx, error);\n // we either sent the wrong expectedFilesVersion or we received\n // a filesVersion that is greater than the expectedFilesVersion\n // + 1, so we need to stop what we're doing and get in sync\n await this.sync();\n }\n });\n }\n\n /**\n * Subscribes to file changes on Gadget and executes the provided\n * callbacks before and after the changes occur.\n *\n * @param options - The options to use.\n * @param options.beforeChanges - A callback that is called before the changes occur.\n * @param options.afterChanges - A callback that is called after the changes occur.\n * @param options.onError - A callback that is called if an error occurs.\n * @returns A function that unsubscribes from changes on Gadget.\n */\n subscribeToGadgetChanges({\n beforeChanges = noop,\n afterChanges = noop,\n onError,\n }: {\n beforeChanges?: (data: { changed: string[]; deleted: string[] }) => Promisable<void>;\n afterChanges?: (data: { changes: Changes }) => Promisable<void>;\n onError: (error: unknown) => void;\n }): () => void {\n return this.edit.subscribe({\n subscription: REMOTE_FILE_SYNC_EVENTS_SUBSCRIPTION,\n // the reason this is a function rather than a static value is\n // so that it will be re-evaluated if the connection is lost and\n // then re-established. this ensures that we send our current\n // filesVersion rather than the one that was sent when we first\n // subscribed\n variables: () => ({ localFilesVersion: String(this.filesVersion) }),\n onError,\n onData: ({ remoteFileSyncEvents: { changed, deleted, remoteFilesVersion } }) => {\n this._syncOperations\n .add(async () => {\n if (BigInt(remoteFilesVersion) < this.filesVersion) {\n this.ctx.log.warn(\"skipping received changes because files version is outdated\", { filesVersion: remoteFilesVersion });\n return;\n }\n\n this.ctx.log.debug(\"received files\", {\n remoteFilesVersion,\n changed: changed.map((change) => change.path),\n deleted: deleted.map((change) => change.path),\n });\n\n const filterIgnoredFiles = (file: { path: string }): boolean => {\n const ignored = this.directory.ignores(file.path);\n if (ignored) {\n this.ctx.log.warn(\"skipping received change because file is ignored\", { path: file.path });\n }\n return !ignored;\n };\n\n changed = changed.filter(filterIgnoredFiles);\n deleted = deleted.filter(filterIgnoredFiles);\n\n if (changed.length === 0 && deleted.length === 0) {\n await this._save(remoteFilesVersion);\n return;\n }\n\n await beforeChanges({\n changed: changed.map((file) => file.path),\n deleted: deleted.map((file) => file.path),\n });\n\n const changes = await this._writeToLocalFilesystem({\n filesVersion: remoteFilesVersion,\n files: changed,\n delete: deleted.map((file) => file.path),\n });\n\n if (changes.size > 0) {\n printChanges(this.ctx, {\n message: sprint`← Received {gray ${dayjs().format(\"hh:mm:ss A\")}}`,\n changes,\n tense: \"past\",\n limit: 10,\n });\n }\n\n await afterChanges({ changes });\n })\n .catch(onError);\n },\n });\n }\n\n /**\n * Ensures the local filesystem is in sync with Gadget's filesystem.\n * - All non-conflicting changes are automatically merged.\n * - Conflicts are resolved by prompting the user to either keep their local changes or keep Gadget's changes.\n * - This function will not return until the filesystem is in sync.\n */\n async sync({ maxAttempts = 10 }: { maxAttempts?: number } = {}): Promise<void> {\n let attempt = 0;\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition\n while (true) {\n const { inSync, ...hashes } = await this.hashes();\n\n if (inSync) {\n this._syncOperations.clear();\n this.ctx.log.info(\"filesystem is in sync\", { attempt });\n await this._save(hashes.gadgetFilesVersion);\n return;\n }\n\n if (attempt++ >= maxAttempts) {\n throw new TooManySyncAttemptsError(maxAttempts);\n }\n\n try {\n this.ctx.log.info(\"syncing\", { attempt, ...hashes });\n await this._sync(hashes);\n } catch (error) {\n swallowFilesVersionMismatch(this.ctx, error);\n // we either sent the wrong expectedFilesVersion or we received\n // a filesVersion that is greater than the expectedFilesVersion\n // + 1, so try again\n }\n }\n }\n\n async _sync({ filesVersionHashes, localHashes, gadgetHashes, gadgetFilesVersion }: Omit<FileSyncHashes, \"inSync\">): Promise<void> {\n let localChanges = getChanges(this.ctx, { from: filesVersionHashes, to: localHashes, existing: gadgetHashes, ignore: [\".gadget/\"] });\n let gadgetChanges = getChanges(this.ctx, { from: filesVersionHashes, to: gadgetHashes, existing: localHashes });\n\n if (localChanges.size === 0 && gadgetChanges.size === 0) {\n // the local filesystem is missing .gadget/ files\n gadgetChanges = getChanges(this.ctx, { from: localHashes, to: gadgetHashes });\n assertAllGadgetFiles({ gadgetChanges });\n }\n\n assert(localChanges.size > 0 || gadgetChanges.size > 0, \"there must be changes if hashes don't match\");\n\n const conflicts = getConflicts({ localChanges, gadgetChanges });\n if (conflicts.size > 0) {\n this.ctx.log.debug(\"conflicts detected\", { conflicts });\n\n let preference = this.ctx.args[\"--prefer\"];\n if (!preference) {\n printConflicts(this.ctx, {\n message: sprint`{bold You have conflicting changes with Gadget}`,\n conflicts,\n });\n\n preference = await select(this.ctx, {\n message: \"How would you like to resolve these conflicts?\",\n choices: Object.values(ConflictPreference),\n });\n }\n\n switch (preference) {\n case ConflictPreference.CANCEL: {\n process.exit(0);\n break;\n }\n case ConflictPreference.LOCAL: {\n gadgetChanges = withoutConflictingChanges({ conflicts, changes: gadgetChanges });\n break;\n }\n case ConflictPreference.GADGET: {\n localChanges = withoutConflictingChanges({ conflicts, changes: localChanges });\n break;\n }\n }\n }\n\n if (gadgetChanges.size > 0) {\n await this._getChangesFromGadget({ changes: gadgetChanges, filesVersion: gadgetFilesVersion });\n }\n\n if (localChanges.size > 0) {\n await this._sendChangesToGadget({ changes: localChanges, expectedFilesVersion: gadgetFilesVersion });\n }\n }\n\n async hashes(): Promise<FileSyncHashes> {\n const [localHashes, { filesVersionHashes, gadgetHashes, gadgetFilesVersion }] = await Promise.all([\n // get the hashes of our local files\n this.directory.hashes(),\n // get the hashes of our local filesVersion and the latest filesVersion\n (async () => {\n let gadgetFilesVersion: bigint;\n let gadgetHashes: Hashes;\n let filesVersionHashes: Hashes;\n\n if (this.filesVersion === 0n) {\n // this is the first time we're syncing, so just get the\n // hashes of the latest filesVersion\n const { fileSyncHashes } = await this.edit.query({ query: FILE_SYNC_HASHES_QUERY });\n gadgetFilesVersion = BigInt(fileSyncHashes.filesVersion);\n gadgetHashes = fileSyncHashes.hashes;\n filesVersionHashes = {};\n } else {\n // this isn't the first time we're syncing, so get the hashes\n // of the files at our local filesVersion and the latest\n // filesVersion\n const { fileSyncComparisonHashes } = await this.edit.query({\n query: FILE_SYNC_COMPARISON_HASHES_QUERY,\n variables: { filesVersion: String(this.filesVersion) },\n });\n gadgetFilesVersion = BigInt(fileSyncComparisonHashes.latestFilesVersionHashes.filesVersion);\n gadgetHashes = fileSyncComparisonHashes.latestFilesVersionHashes.hashes;\n filesVersionHashes = fileSyncComparisonHashes.filesVersionHashes.hashes;\n }\n\n return { filesVersionHashes, gadgetHashes, gadgetFilesVersion };\n })(),\n ]);\n\n return {\n filesVersionHashes,\n localHashes,\n gadgetHashes,\n gadgetFilesVersion,\n inSync: isEqualHashes(this.ctx, localHashes, gadgetHashes),\n };\n }\n\n private async _getChangesFromGadget({\n filesVersion,\n changes,\n }: {\n filesVersion: bigint;\n changes: Changes | ChangesWithHash;\n }): Promise<void> {\n this.ctx.log.debug(\"getting changes from gadget\", { filesVersion, changes });\n const created = changes.created();\n const updated = changes.updated();\n\n let files: File[] = [];\n if (created.length > 0 || updated.length > 0) {\n const { fileSyncFiles } = await this.edit.query({\n query: FILE_SYNC_FILES_QUERY,\n variables: {\n paths: [...created, ...updated],\n filesVersion: String(filesVersion),\n encoding: FileSyncEncoding.Base64,\n },\n });\n\n files = fileSyncFiles.files;\n }\n\n await this._writeToLocalFilesystem({\n filesVersion,\n files,\n delete: changes.deleted(),\n });\n\n printChanges(this.ctx, {\n changes,\n tense: \"past\",\n message: sprint`← Received {gray ${dayjs().format(\"hh:mm:ss A\")}}`,\n });\n }\n\n private async _sendChangesToGadget({\n expectedFilesVersion = this.filesVersion,\n changes,\n printLimit,\n }: {\n expectedFilesVersion?: bigint;\n changes: Changes;\n printLimit?: number;\n }): Promise<void> {\n this.ctx.log.debug(\"sending changes to gadget\", { expectedFilesVersion, changes });\n const changed: FileSyncChangedEventInput[] = [];\n const deleted: FileSyncDeletedEventInput[] = [];\n\n await pMap(changes, async ([normalizedPath, change]) => {\n if (change.type === \"delete\") {\n deleted.push({ path: normalizedPath });\n return;\n }\n\n const absolutePath = this.directory.absolute(normalizedPath);\n\n let stats;\n try {\n stats = await fs.stat(absolutePath);\n } catch (error) {\n swallowEnoent(error);\n this.ctx.log.debug(\"skipping change because file doesn't exist\", { path: normalizedPath });\n return;\n }\n\n let content = \"\";\n if (stats.isFile()) {\n content = await fs.readFile(absolutePath, FileSyncEncoding.Base64);\n }\n\n let oldPath;\n if (change.type === \"create\" && change.oldPath) {\n oldPath = change.oldPath;\n }\n\n changed.push({\n content,\n oldPath,\n path: normalizedPath,\n mode: stats.mode,\n encoding: FileSyncEncoding.Base64,\n });\n });\n\n if (changed.length === 0 && deleted.length === 0) {\n this.ctx.log.debug(\"skipping send because there are no changes\");\n return;\n }\n\n const {\n publishFileSyncEvents: { remoteFilesVersion },\n } = await this.edit.mutate({\n mutation: PUBLISH_FILE_SYNC_EVENTS_MUTATION,\n variables: {\n input: {\n expectedRemoteFilesVersion: String(expectedFilesVersion),\n changed,\n deleted,\n },\n },\n http: {\n retry: {\n // we can retry this request because\n // expectedRemoteFilesVersion makes it idempotent\n methods: [\"POST\"],\n calculateDelay: ({ error, computedValue }) => {\n if (isFilesVersionMismatchError(error.response?.body)) {\n // don't retry if we get a files version mismatch error\n return 0;\n }\n return computedValue;\n },\n },\n },\n });\n\n printChanges(this.ctx, {\n changes,\n tense: \"past\",\n message: sprint`→ Sent {gray ${dayjs().format(\"hh:mm:ss A\")}}`,\n limit: printLimit,\n });\n\n if (BigInt(remoteFilesVersion) > expectedFilesVersion + 1n) {\n // we can't save the remoteFilesVersion because we haven't\n // received the intermediate filesVersions yet\n throw new Error(\"Files version mismatch\");\n }\n\n await this._save(remoteFilesVersion);\n }\n\n private async _writeToLocalFilesystem(options: { filesVersion: bigint | string; files: File[]; delete: string[] }): Promise<Changes> {\n const filesVersion = BigInt(options.filesVersion);\n assert(filesVersion >= this.filesVersion, \"filesVersion must be greater than or equal to current filesVersion\");\n\n this.ctx.log.debug(\"writing to local filesystem\", {\n filesVersion,\n files: options.files.map((file) => file.path),\n delete: options.delete,\n });\n\n const created: string[] = [];\n const updated: string[] = [];\n\n await pMap(options.delete, async (filepath) => {\n const currentPath = this.directory.absolute(filepath);\n const backupPath = this.directory.absolute(\".gadget/backup\", this.directory.relative(filepath));\n\n // rather than `rm -rf`ing files, we move them to\n // `.gadget/backup/` so that users can recover them if something\n // goes wrong. We've seen a lot of EBUSY/EINVAL errors when moving\n // files so we retry a few times.\n await pRetry(\n async () => {\n try {\n // remove the current backup file in case it exists and is a\n // different type (file vs directory)\n await fs.remove(backupPath);\n await fs.move(currentPath, backupPath);\n } catch (error) {\n // replicate the behavior of `rm -rf` and ignore ENOENT\n swallowEnoent(error);\n }\n },\n {\n // windows tends to run into these issues way more often than\n // mac/linux, so we retry more times\n retries: config.windows ? 4 : 2,\n minTimeout: ms(\"100ms\"),\n onFailedAttempt: (error) => {\n this.ctx.log.warn(\"failed to move file to backup\", { error, currentPath, backupPath });\n },\n },\n );\n });\n\n await pMap(options.files, async (file) => {\n const absolutePath = this.directory.absolute(file.path);\n if (await fs.pathExists(absolutePath)) {\n updated.push(file.path);\n } else {\n created.push(file.path);\n }\n\n if (file.path.endsWith(\"/\")) {\n await fs.ensureDir(absolutePath);\n } else {\n await fs.outputFile(absolutePath, Buffer.from(file.content, file.encoding));\n }\n\n if (supportsPermissions) {\n // the os's default umask makes setting the mode during creation\n // not work, so an additional fs.chmod call is necessary to\n // ensure the file has the correct mode\n await fs.chmod(absolutePath, file.mode & 0o777);\n }\n\n if (absolutePath === this.directory.absolute(\".ignore\")) {\n await this.directory.loadIgnoreFile();\n }\n });\n\n await this._save(String(filesVersion));\n\n const changes = new Changes([\n ...created.map((path) => [path, { type: \"create\" }] as const),\n ...updated.map((path) => [path, { type: \"update\" }] as const),\n ...options.delete.map((path) => [path, { type: \"delete\" }] as const),\n ]);\n\n if (changes.has(\"yarn.lock\")) {\n this.ctx.log.info(\"running yarn install --check-files\");\n await execa(\"yarn\", [\"install\", \"--check-files\"], { cwd: this.directory.path })\n .then(() => this.ctx.log.info(\"yarn install complete\"))\n .catch((error: unknown) => this.ctx.log.error(\"yarn install failed\", { error }));\n }\n\n return changes;\n }\n\n /**\n * Updates {@linkcode _syncJson} and saves it to `.gadget/sync.json`.\n */\n private async _save(filesVersion: string | bigint): Promise<void> {\n this._syncJson = { ...this._syncJson, mtime: Date.now() + 1, filesVersion: String(filesVersion) };\n this.ctx.log.debug(\"saving .gadget/sync.json\");\n await fs.outputJSON(this.directory.absolute(\".gadget/sync.json\"), this._syncJson, { spaces: 2 });\n }\n}\n\n/**\n * Checks if a directory is empty or non-existent.\n *\n * @param dir - The directory path to check.\n * @returns A Promise that resolves to a boolean indicating whether the directory is empty or non-existent.\n */\nexport const isEmptyOrNonExistentDir = async (dir: string): Promise<boolean> => {\n try {\n for await (const _ of await fs.opendir(dir, { bufferSize: 1 })) {\n return false;\n }\n return true;\n } catch (error) {\n swallowEnoent(error);\n return true;\n }\n};\n\nexport const assertAllGadgetFiles = ({ gadgetChanges }: { gadgetChanges: Changes }): void => {\n assert(\n gadgetChanges.created().length > 0 || gadgetChanges.deleted().length > 0 || gadgetChanges.updated().length > 0,\n \"expected gadgetChanges to have changes\",\n );\n\n const allGadgetFiles = Array.from(gadgetChanges.keys()).every((path) => path.startsWith(\".gadget/\"));\n assert(allGadgetFiles, \"expected all gadgetChanges to be .gadget/ files\");\n};\n\nexport const ConflictPreference = Object.freeze({\n CANCEL: \"Cancel (Ctrl+C)\",\n LOCAL: \"Keep my conflicting changes\",\n GADGET: \"Keep Gadget's conflicting changes\",\n});\n\nexport type ConflictPreference = (typeof ConflictPreference)[keyof typeof ConflictPreference];\n\nexport const ConflictPreferenceArg = (value: string, name: string): ConflictPreference => {\n if ([\"local\", \"gadget\"].includes(value)) {\n return ConflictPreference[value.toUpperCase() as keyof typeof ConflictPreference];\n }\n\n throw new ArgError(sprint`\n ${name} must be {bold local} or {bold gadget}\n\n {bold EXAMPLES:}\n ${name} local\n ${name} gadget\n `);\n};\n\nexport const FileSyncArgs = {\n \"--app\": { type: AppArg, alias: \"-a\" },\n \"--prefer\": ConflictPreferenceArg,\n \"--force\": Boolean,\n} satisfies ArgsDefinition;\n\nexport type FileSyncArgs = typeof FileSyncArgs;\n\nexport const isFilesVersionMismatchError = (error: unknown): boolean => {\n if (error instanceof EditError) {\n error = error.cause;\n }\n if (isGraphQLResult(error)) {\n error = error.errors;\n }\n if (isGraphQLErrors(error)) {\n error = error[0];\n }\n return isObject(error) && \"message\" in error && isString(error.message) && error.message.startsWith(\"Files version mismatch\");\n};\n\nconst swallowFilesVersionMismatch = (ctx: Context, error: unknown): void => {\n if (isFilesVersionMismatchError(error)) {\n ctx.log.debug(\"swallowing files version mismatch\", { error });\n return;\n }\n throw error;\n};\n"],"names":["dayjs","execa","findUp","fs","ms","assert","path","process","pMap","PQueue","pRetry","z","FileSyncEncoding","getApps","AppArg","Edit","EditError","FILE_SYNC_COMPARISON_HASHES_QUERY","FILE_SYNC_FILES_QUERY","FILE_SYNC_HASHES_QUERY","PUBLISH_FILE_SYNC_EVENTS_MUTATION","REMOTE_FILE_SYNC_EVENTS_SUBSCRIPTION","ArgError","config","homePath","select","sprint","getUserOrLogin","sortBySimilar","noop","isGraphQLErrors","isGraphQLResult","isObject","isString","Changes","printChanges","getConflicts","printConflicts","withoutConflictingChanges","Directory","supportsPermissions","swallowEnoent","InvalidSyncFileError","TooManySyncAttemptsError","getChanges","isEqualHashes","FileSync","filesVersion","BigInt","_syncJson","mtime","init","ctx","child","name","user","apps","length","email","dir","args","_","filepath","join","cwd","windows","startsWith","slice","wasEmptyOrNonExistent","isEmptyOrNonExistentDir","ensureDir","resolve","state","readJson","then","json","object","app","string","number","parse","catch","appSlug","message","choices","map","x","slug","find","similarAppSlugs","concat","directory","idle","_syncOperations","onIdle","sendChangesToGadget","changes","add","_sendChangesToGadget","error","swallowFilesVersionMismatch","sync","subscribeToGadgetChanges","beforeChanges","afterChanges","onError","edit","subscribe","subscription","variables","localFilesVersion","String","onData","remoteFileSyncEvents","changed","deleted","remoteFilesVersion","log","warn","debug","change","filterIgnoredFiles","file","ignored","ignores","filter","_save","_writeToLocalFilesystem","files","delete","size","format","tense","limit","maxAttempts","attempt","inSync","hashes","clear","info","gadgetFilesVersion","_sync","filesVersionHashes","localHashes","gadgetHashes","localChanges","from","to","existing","ignore","gadgetChanges","assertAllGadgetFiles","conflicts","preference","Object","values","ConflictPreference","CANCEL","exit","LOCAL","GADGET","_getChangesFromGadget","expectedFilesVersion","Promise","all","fileSyncHashes","query","fileSyncComparisonHashes","latestFilesVersionHashes","created","updated","fileSyncFiles","paths","encoding","Base64","printLimit","normalizedPath","type","push","absolutePath","absolute","stats","stat","content","isFile","readFile","oldPath","mode","publishFileSyncEvents","mutate","mutation","input","expectedRemoteFilesVersion","http","retry","methods","calculateDelay","computedValue","isFilesVersionMismatchError","response","body","Error","options","currentPath","backupPath","relative","remove","move","retries","minTimeout","onFailedAttempt","pathExists","endsWith","outputFile","Buffer","chmod","loadIgnoreFile","has","Date","now","outputJSON","spaces","concurrency","fields","filesync","opendir","bufferSize","allGadgetFiles","Array","keys","every","freeze","ConflictPreferenceArg","value","includes","toUpperCase","FileSyncArgs","alias","Boolean","cause","errors"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,KAAK,QAAQ,QAAQ;AAC9B,SAASC,MAAM,QAAQ,UAAU;AACjC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,cAAc;AACjC,OAAOC,UAAU,YAAY;AAC7B,OAAOC,aAAa,eAAe;AACnC,OAAOC,UAAU,QAAQ;AACzB,OAAOC,YAAY,UAAU;AAC7B,OAAOC,YAAY,UAAU;AAE7B,SAASC,CAAC,QAAQ,MAAM;AACxB,SAASC,gBAAgB,QAAwE,iCAAiC;AAElI,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACEC,iCAAiC,EACjCC,qBAAqB,EACrBC,sBAAsB,EACtBC,iCAAiC,EACjCC,oCAAoC,QAC/B,2BAA2B;AAClC,SAASC,QAAQ,QAA6B,oBAAoB;AAElE,SAASC,MAAM,EAAEC,QAAQ,QAAQ,sBAAsB;AACvD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,S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8B,CAAChD,KAAc+C;IACjD,IAAImG,4BAA4BnG,QAAQ;QACtC/C,IAAIiE,GAAG,CAACE,KAAK,CAAC,qCAAqC;YAAEpB;QAAM;QAC3D;IACF;IACA,MAAMA;AACR"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { got } from "got";
|
|
2
|
+
import ms from "ms";
|
|
2
3
|
import assert from "node:assert";
|
|
3
4
|
import { Agent as HttpAgent } from "node:http";
|
|
4
5
|
import { Agent as HttpsAgent } from "node:https";
|
|
@@ -31,6 +32,45 @@ const getContext = (options)=>{
|
|
|
31
32
|
keepAlive: true
|
|
32
33
|
})
|
|
33
34
|
},
|
|
35
|
+
retry: {
|
|
36
|
+
limit: 10,
|
|
37
|
+
methods: [
|
|
38
|
+
"GET",
|
|
39
|
+
"PUT",
|
|
40
|
+
"HEAD",
|
|
41
|
+
"DELETE",
|
|
42
|
+
"OPTIONS",
|
|
43
|
+
"TRACE"
|
|
44
|
+
],
|
|
45
|
+
statusCodes: [
|
|
46
|
+
408,
|
|
47
|
+
413,
|
|
48
|
+
429,
|
|
49
|
+
500,
|
|
50
|
+
502,
|
|
51
|
+
503,
|
|
52
|
+
504,
|
|
53
|
+
521,
|
|
54
|
+
522,
|
|
55
|
+
524
|
|
56
|
+
],
|
|
57
|
+
errorCodes: [
|
|
58
|
+
"ETIMEDOUT",
|
|
59
|
+
"ECONNRESET",
|
|
60
|
+
"EADDRINUSE",
|
|
61
|
+
"ECONNREFUSED",
|
|
62
|
+
"EPIPE",
|
|
63
|
+
"ENOTFOUND",
|
|
64
|
+
"ENETUNREACH",
|
|
65
|
+
"EAI_AGAIN",
|
|
66
|
+
"EADDRNOTAVAIL",
|
|
67
|
+
"EHOSTUNREACH"
|
|
68
|
+
],
|
|
69
|
+
maxRetryAfter: undefined,
|
|
70
|
+
calculateDelay: ({ computedValue })=>computedValue,
|
|
71
|
+
backoffLimit: ms("5s"),
|
|
72
|
+
noise: 100
|
|
73
|
+
},
|
|
34
74
|
hooks: {
|
|
35
75
|
beforeRequest: [
|
|
36
76
|
(options)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/http/http.ts"],"sourcesContent":["import { got, type OptionsInit } from \"got\";\nimport assert from \"node:assert\";\nimport { Agent as HttpAgent } from \"node:http\";\nimport { Agent as HttpsAgent } from \"node:https\";\nimport { Context } from \"../command/context.js\";\nimport { config } from \"../config/config.js\";\nimport { sprint } from \"../output/sprint.js\";\nimport { writeSession } from \"../user/session.js\";\nimport { serializeError } from \"../util/object.js\";\nimport { isGadgetServicesRequest } from \"./auth.js\";\n\nexport type HttpOptions = OptionsInit;\n\nconst getContext = (options: HttpOptions): Context => {\n assert(\n options.context?.[\"ctx\"] instanceof Context,\n sprint(`\n ctx must be provided to http requests:\n\n const response = await http({\n context: { ctx },\n ...options,\n });\n `),\n );\n\n return options.context[\"ctx\"] as Context;\n};\n\n/**\n * An instance of the `got` library with hooks for logging and handling\n * 401 errors. This should be used for all HTTP requests.\n */\nexport const http = got.extend({\n agent: {\n http: new HttpAgent({ keepAlive: true }),\n https: new HttpsAgent({ keepAlive: true }),\n },\n hooks: {\n beforeRequest: [\n (options) => {\n const ctx = getContext(options);\n options.signal = ctx.signal;\n options.headers[\"user-agent\"] = config.versionFull;\n ctx.log.debug(\"http request\", {\n http: {\n request: {\n method: options.method,\n url: options.url?.toString(),\n },\n },\n });\n },\n ],\n beforeRetry: [\n (error, retryCount) => {\n const ctx = getContext(error.request?.options ?? error.options.context);\n ctx.log.warn(\"http request failed, retrying...\", {\n http: {\n retryCount,\n error: serializeError(error),\n request: error.request && {\n method: error.request.options.method,\n url: error.request.options.url?.toString(),\n },\n },\n });\n },\n ],\n afterResponse: [\n (response) => {\n const ctx = getContext(response.request.options);\n ctx.log.debug(\"http response\", {\n http: {\n request: {\n method: response.request.options.method,\n url: response.request.options.url?.toString(),\n },\n response: {\n statusCode: response.statusCode,\n traceId: response.headers[\"x-trace-id\"],\n durationMs: response.timings.phases.total,\n },\n },\n });\n\n if (response.statusCode === 401 && isGadgetServicesRequest(response.request.options)) {\n // clear the session if the request was unauthorized\n writeSession(undefined);\n }\n\n return response;\n },\n ],\n },\n});\n"],"names":["got","assert","Agent","HttpAgent","HttpsAgent","Context","config","sprint","writeSession","serializeError","isGadgetServicesRequest","getContext","options","context","http","extend","agent","keepAlive","https","hooks","beforeRequest","ctx","signal","headers","versionFull","log","debug","request","method","url","toString","beforeRetry","error","retryCount","warn","afterResponse","response","statusCode","traceId","durationMs","timings","phases","total"
|
|
1
|
+
{"version":3,"sources":["../../../src/services/http/http.ts"],"sourcesContent":["import { got, type OptionsInit } from \"got\";\nimport ms from \"ms\";\nimport assert from \"node:assert\";\nimport { Agent as HttpAgent } from \"node:http\";\nimport { Agent as HttpsAgent } from \"node:https\";\nimport { Context } from \"../command/context.js\";\nimport { config } from \"../config/config.js\";\nimport { sprint } from \"../output/sprint.js\";\nimport { writeSession } from \"../user/session.js\";\nimport { serializeError } from \"../util/object.js\";\nimport { isGadgetServicesRequest } from \"./auth.js\";\n\nexport type HttpOptions = OptionsInit;\n\nconst getContext = (options: HttpOptions): Context => {\n assert(\n options.context?.[\"ctx\"] instanceof Context,\n sprint(`\n ctx must be provided to http requests:\n\n const response = await http({\n context: { ctx },\n ...options,\n });\n `),\n );\n\n return options.context[\"ctx\"] as Context;\n};\n\n/**\n * An instance of the `got` library with hooks for logging and handling\n * 401 errors. This should be used for all HTTP requests.\n */\nexport const http = got.extend({\n agent: {\n http: new HttpAgent({ keepAlive: true }),\n https: new HttpsAgent({ keepAlive: true }),\n },\n retry: {\n limit: 10,\n methods: [\"GET\", \"PUT\", \"HEAD\", \"DELETE\", \"OPTIONS\", \"TRACE\"],\n statusCodes: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],\n errorCodes: [\n \"ETIMEDOUT\",\n \"ECONNRESET\",\n \"EADDRINUSE\",\n \"ECONNREFUSED\",\n \"EPIPE\",\n \"ENOTFOUND\",\n \"ENETUNREACH\",\n \"EAI_AGAIN\",\n \"EADDRNOTAVAIL\",\n \"EHOSTUNREACH\",\n ],\n maxRetryAfter: undefined,\n calculateDelay: ({ computedValue }) => computedValue,\n backoffLimit: ms(\"5s\"),\n noise: 100,\n },\n hooks: {\n beforeRequest: [\n (options) => {\n const ctx = getContext(options);\n options.signal = ctx.signal;\n options.headers[\"user-agent\"] = config.versionFull;\n ctx.log.debug(\"http request\", {\n http: {\n request: {\n method: options.method,\n url: options.url?.toString(),\n },\n },\n });\n },\n ],\n beforeRetry: [\n (error, retryCount) => {\n const ctx = getContext(error.request?.options ?? error.options.context);\n ctx.log.warn(\"http request failed, retrying...\", {\n http: {\n retryCount,\n error: serializeError(error),\n request: error.request && {\n method: error.request.options.method,\n url: error.request.options.url?.toString(),\n },\n },\n });\n },\n ],\n afterResponse: [\n (response) => {\n const ctx = getContext(response.request.options);\n ctx.log.debug(\"http response\", {\n http: {\n request: {\n method: response.request.options.method,\n url: response.request.options.url?.toString(),\n },\n response: {\n statusCode: response.statusCode,\n traceId: response.headers[\"x-trace-id\"],\n durationMs: response.timings.phases.total,\n },\n },\n });\n\n if (response.statusCode === 401 && isGadgetServicesRequest(response.request.options)) {\n // clear the session if the request was unauthorized\n writeSession(undefined);\n }\n\n return response;\n },\n ],\n },\n});\n"],"names":["got","ms","assert","Agent","HttpAgent","HttpsAgent","Context","config","sprint","writeSession","serializeError","isGadgetServicesRequest","getContext","options","context","http","extend","agent","keepAlive","https","retry","limit","methods","statusCodes","errorCodes","maxRetryAfter","undefined","calculateDelay","computedValue","backoffLimit","noise","hooks","beforeRequest","ctx","signal","headers","versionFull","log","debug","request","method","url","toString","beforeRetry","error","retryCount","warn","afterResponse","response","statusCode","traceId","durationMs","timings","phases","total"],"mappings":"AAAA,SAASA,GAAG,QAA0B,MAAM;AAC5C,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,cAAc;AACjC,SAASC,SAASC,SAAS,QAAQ,YAAY;AAC/C,SAASD,SAASE,UAAU,QA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,aAAa;YACX,CAACC,OAAOC;gBACN,MAAMZ,MAAMrB,WAAWgC,MAAML,OAAO,EAAE1B,WAAW+B,MAAM/B,OAAO,CAACC,OAAO;gBACtEmB,IAAII,GAAG,CAACS,IAAI,CAAC,oCAAoC;oBAC/C/B,MAAM;wBACJ8B;wBACAD,OAAOlC,eAAekC;wBACtBL,SAASK,MAAML,OAAO,IAAI;4BACxBC,QAAQI,MAAML,OAAO,CAAC1B,OAAO,CAAC2B,MAAM;4BACpCC,KAAKG,MAAML,OAAO,CAAC1B,OAAO,CAAC4B,GAAG,EAAEC;wBAClC;oBACF;gBACF;YACF;SACD;QACDK,eAAe;YACb,CAACC;gBACC,MAAMf,MAAMrB,WAAWoC,SAAST,OAAO,CAAC1B,OAAO;gBAC/CoB,IAAII,GAAG,CAACC,KAAK,CAAC,iBAAiB;oBAC7BvB,MAAM;wBACJwB,SAAS;4BACPC,QAAQQ,SAAST,OAAO,CAAC1B,OAAO,CAAC2B,MAAM;4BACvCC,KAAKO,SAAST,OAAO,CAAC1B,OAAO,CAAC4B,GAAG,EAAEC;wBACrC;wBACAM,UAAU;4BACRC,YAAYD,SAASC,UAAU;4BAC/BC,SAASF,SAASb,OAAO,CAAC,aAAa;4BACvCgB,YAAYH,SAASI,OAAO,CAACC,MAAM,CAACC,KAAK;wBAC3C;oBACF;gBACF;gBAEA,IAAIN,SAASC,UAAU,KAAK,OAAOtC,wBAAwBqC,SAAST,OAAO,CAAC1B,OAAO,GAAG;oBACpF,oDAAoD;oBACpDJ,aAAaiB;gBACf;gBAEA,OAAOsB;YACT;SACD;IACH;AACF,GAAG"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadgetinc/ggt",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@gadgetinc/ggt",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.9",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@sentry/node": "^7.
|
|
12
|
+
"@sentry/node": "^7.93.0",
|
|
13
13
|
"@swc/helpers": "^0.5.3",
|
|
14
14
|
"arg": "^5.0.2",
|
|
15
15
|
"boxen": "^7.1.1",
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
"@swc-node/register": "^1.6.8",
|
|
63
63
|
"@swc/cli": "^0.1.63",
|
|
64
64
|
"@swc/core": "^1.3.102",
|
|
65
|
-
"@types/eslint": "^8.56.
|
|
65
|
+
"@types/eslint": "^8.56.2",
|
|
66
66
|
"@types/fast-levenshtein": "^0.0.4",
|
|
67
67
|
"@types/fs-extra": "^11.0.4",
|
|
68
68
|
"@types/ms": "^0.7.34",
|
|
69
|
-
"@types/node": "^18.19.
|
|
69
|
+
"@types/node": "^18.19.6",
|
|
70
70
|
"@types/node-notifier": "^8.0.5",
|
|
71
71
|
"@types/normalize-path": "^3.0.2",
|
|
72
72
|
"@types/pluralize": "^0.0.33",
|
|
73
73
|
"@types/prompts": "^2.4.9",
|
|
74
74
|
"@types/which": "^3.0.3",
|
|
75
75
|
"@types/ws": "^8.5.10",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
77
|
-
"@typescript-eslint/parser": "^6.
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
77
|
+
"@typescript-eslint/parser": "^6.18.1",
|
|
78
78
|
"concurrently": "^8.2.2",
|
|
79
79
|
"cspell": "^7.3.8",
|
|
80
80
|
"eslint": "^8.56.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"nock": "^13.4.0",
|
|
89
89
|
"prettier": "^3.1.1",
|
|
90
90
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
91
|
-
"prettier-plugin-packagejson": "^2.4.
|
|
91
|
+
"prettier-plugin-packagejson": "^2.4.9",
|
|
92
92
|
"remark": "^15.0.1",
|
|
93
93
|
"remark-gfm": "^4.0.0",
|
|
94
94
|
"remark-toc": "^9.0.0",
|
|
@@ -4551,39 +4551,39 @@
|
|
|
4551
4551
|
"dev": true
|
|
4552
4552
|
},
|
|
4553
4553
|
"node_modules/@sentry-internal/tracing": {
|
|
4554
|
-
"version": "7.
|
|
4555
|
-
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.
|
|
4556
|
-
"integrity": "sha512-
|
|
4554
|
+
"version": "7.93.0",
|
|
4555
|
+
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.93.0.tgz",
|
|
4556
|
+
"integrity": "sha512-DjuhmQNywPp+8fxC9dvhGrqgsUb6wI/HQp25lS2Re7VxL1swCasvpkg8EOYP4iBniVQ86QK0uITkOIRc5tdY1w==",
|
|
4557
4557
|
"dependencies": {
|
|
4558
|
-
"@sentry/core": "7.
|
|
4559
|
-
"@sentry/types": "7.
|
|
4560
|
-
"@sentry/utils": "7.
|
|
4558
|
+
"@sentry/core": "7.93.0",
|
|
4559
|
+
"@sentry/types": "7.93.0",
|
|
4560
|
+
"@sentry/utils": "7.93.0"
|
|
4561
4561
|
},
|
|
4562
4562
|
"engines": {
|
|
4563
4563
|
"node": ">=8"
|
|
4564
4564
|
}
|
|
4565
4565
|
},
|
|
4566
4566
|
"node_modules/@sentry/core": {
|
|
4567
|
-
"version": "7.
|
|
4568
|
-
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.
|
|
4569
|
-
"integrity": "sha512-
|
|
4567
|
+
"version": "7.93.0",
|
|
4568
|
+
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.93.0.tgz",
|
|
4569
|
+
"integrity": "sha512-vZQSUiDn73n+yu2fEcH+Wpm4GbRmtxmnXnYCPgM6IjnXqkVm3awWAkzrheADblx3kmxrRiOlTXYHw9NTWs56fg==",
|
|
4570
4570
|
"dependencies": {
|
|
4571
|
-
"@sentry/types": "7.
|
|
4572
|
-
"@sentry/utils": "7.
|
|
4571
|
+
"@sentry/types": "7.93.0",
|
|
4572
|
+
"@sentry/utils": "7.93.0"
|
|
4573
4573
|
},
|
|
4574
4574
|
"engines": {
|
|
4575
4575
|
"node": ">=8"
|
|
4576
4576
|
}
|
|
4577
4577
|
},
|
|
4578
4578
|
"node_modules/@sentry/node": {
|
|
4579
|
-
"version": "7.
|
|
4580
|
-
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.
|
|
4581
|
-
"integrity": "sha512-
|
|
4582
|
-
"dependencies": {
|
|
4583
|
-
"@sentry-internal/tracing": "7.
|
|
4584
|
-
"@sentry/core": "7.
|
|
4585
|
-
"@sentry/types": "7.
|
|
4586
|
-
"@sentry/utils": "7.
|
|
4579
|
+
"version": "7.93.0",
|
|
4580
|
+
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.93.0.tgz",
|
|
4581
|
+
"integrity": "sha512-nUXPCZQm5Y9Ipv7iWXLNp5dbuyi1VvbJ3RtlwD7utgsNkRYB4ixtKE9w2QU8DZZAjaEF6w2X94OkYH6C932FWw==",
|
|
4582
|
+
"dependencies": {
|
|
4583
|
+
"@sentry-internal/tracing": "7.93.0",
|
|
4584
|
+
"@sentry/core": "7.93.0",
|
|
4585
|
+
"@sentry/types": "7.93.0",
|
|
4586
|
+
"@sentry/utils": "7.93.0",
|
|
4587
4587
|
"https-proxy-agent": "^5.0.0"
|
|
4588
4588
|
},
|
|
4589
4589
|
"engines": {
|
|
@@ -4591,19 +4591,19 @@
|
|
|
4591
4591
|
}
|
|
4592
4592
|
},
|
|
4593
4593
|
"node_modules/@sentry/types": {
|
|
4594
|
-
"version": "7.
|
|
4595
|
-
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.
|
|
4596
|
-
"integrity": "sha512-
|
|
4594
|
+
"version": "7.93.0",
|
|
4595
|
+
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.93.0.tgz",
|
|
4596
|
+
"integrity": "sha512-UnzUccNakhFRA/esWBWP+0v7cjNg+RilFBQC03Mv9OEMaZaS29zSbcOGtRzuFOXXLBdbr44BWADqpz3VW0XaNw==",
|
|
4597
4597
|
"engines": {
|
|
4598
4598
|
"node": ">=8"
|
|
4599
4599
|
}
|
|
4600
4600
|
},
|
|
4601
4601
|
"node_modules/@sentry/utils": {
|
|
4602
|
-
"version": "7.
|
|
4603
|
-
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.
|
|
4604
|
-
"integrity": "sha512-
|
|
4602
|
+
"version": "7.93.0",
|
|
4603
|
+
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.93.0.tgz",
|
|
4604
|
+
"integrity": "sha512-Iovj7tUnbgSkh/WrAaMrd5UuYjW7AzyzZlFDIUrwidsyIdUficjCG2OIxYzh76H6nYIx9SxewW0R54Q6XoB4uA==",
|
|
4605
4605
|
"dependencies": {
|
|
4606
|
-
"@sentry/types": "7.
|
|
4606
|
+
"@sentry/types": "7.93.0"
|
|
4607
4607
|
},
|
|
4608
4608
|
"engines": {
|
|
4609
4609
|
"node": ">=8"
|
|
@@ -4986,9 +4986,9 @@
|
|
|
4986
4986
|
}
|
|
4987
4987
|
},
|
|
4988
4988
|
"node_modules/@types/eslint": {
|
|
4989
|
-
"version": "8.56.
|
|
4990
|
-
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.
|
|
4991
|
-
"integrity": "sha512-
|
|
4989
|
+
"version": "8.56.2",
|
|
4990
|
+
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz",
|
|
4991
|
+
"integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==",
|
|
4992
4992
|
"dev": true,
|
|
4993
4993
|
"dependencies": {
|
|
4994
4994
|
"@types/estree": "*",
|
|
@@ -5086,9 +5086,9 @@
|
|
|
5086
5086
|
"dev": true
|
|
5087
5087
|
},
|
|
5088
5088
|
"node_modules/@types/node": {
|
|
5089
|
-
"version": "18.19.
|
|
5090
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.
|
|
5091
|
-
"integrity": "sha512-
|
|
5089
|
+
"version": "18.19.6",
|
|
5090
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.6.tgz",
|
|
5091
|
+
"integrity": "sha512-X36s5CXMrrJOs2lQCdDF68apW4Rfx9ixYMawlepwmE4Anezv/AV2LSpKD1Ub8DAc+urp5bk0BGZ6NtmBitfnsg==",
|
|
5092
5092
|
"dev": true,
|
|
5093
5093
|
"dependencies": {
|
|
5094
5094
|
"undici-types": "~5.26.4"
|
|
@@ -5189,16 +5189,16 @@
|
|
|
5189
5189
|
}
|
|
5190
5190
|
},
|
|
5191
5191
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
|
5192
|
-
"version": "6.
|
|
5193
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.
|
|
5194
|
-
"integrity": "sha512-
|
|
5192
|
+
"version": "6.18.1",
|
|
5193
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz",
|
|
5194
|
+
"integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==",
|
|
5195
5195
|
"dev": true,
|
|
5196
5196
|
"dependencies": {
|
|
5197
5197
|
"@eslint-community/regexpp": "^4.5.1",
|
|
5198
|
-
"@typescript-eslint/scope-manager": "6.
|
|
5199
|
-
"@typescript-eslint/type-utils": "6.
|
|
5200
|
-
"@typescript-eslint/utils": "6.
|
|
5201
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
5198
|
+
"@typescript-eslint/scope-manager": "6.18.1",
|
|
5199
|
+
"@typescript-eslint/type-utils": "6.18.1",
|
|
5200
|
+
"@typescript-eslint/utils": "6.18.1",
|
|
5201
|
+
"@typescript-eslint/visitor-keys": "6.18.1",
|
|
5202
5202
|
"debug": "^4.3.4",
|
|
5203
5203
|
"graphemer": "^1.4.0",
|
|
5204
5204
|
"ignore": "^5.2.4",
|
|
@@ -5224,15 +5224,15 @@
|
|
|
5224
5224
|
}
|
|
5225
5225
|
},
|
|
5226
5226
|
"node_modules/@typescript-eslint/parser": {
|
|
5227
|
-
"version": "6.
|
|
5228
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.
|
|
5229
|
-
"integrity": "sha512-
|
|
5227
|
+
"version": "6.18.1",
|
|
5228
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz",
|
|
5229
|
+
"integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==",
|
|
5230
5230
|
"dev": true,
|
|
5231
5231
|
"dependencies": {
|
|
5232
|
-
"@typescript-eslint/scope-manager": "6.
|
|
5233
|
-
"@typescript-eslint/types": "6.
|
|
5234
|
-
"@typescript-eslint/typescript-estree": "6.
|
|
5235
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
5232
|
+
"@typescript-eslint/scope-manager": "6.18.1",
|
|
5233
|
+
"@typescript-eslint/types": "6.18.1",
|
|
5234
|
+
"@typescript-eslint/typescript-estree": "6.18.1",
|
|
5235
|
+
"@typescript-eslint/visitor-keys": "6.18.1",
|
|
5236
5236
|
"debug": "^4.3.4"
|
|
5237
5237
|
},
|
|
5238
5238
|
"engines": {
|
|
@@ -5252,13 +5252,13 @@
|
|
|
5252
5252
|
}
|
|
5253
5253
|
},
|
|
5254
5254
|
"node_modules/@typescript-eslint/scope-manager": {
|
|
5255
|
-
"version": "6.
|
|
5256
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.
|
|
5257
|
-
"integrity": "sha512-
|
|
5255
|
+
"version": "6.18.1",
|
|
5256
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz",
|
|
5257
|
+
"integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==",
|
|
5258
5258
|
"dev": true,
|
|
5259
5259
|
"dependencies": {
|
|
5260
|
-
"@typescript-eslint/types": "6.
|
|
5261
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
5260
|
+
"@typescript-eslint/types": "6.18.1",
|
|
5261
|
+
"@typescript-eslint/visitor-keys": "6.18.1"
|
|
5262
5262
|
},
|
|
5263
5263
|
"engines": {
|
|
5264
5264
|
"node": "^16.0.0 || >=18.0.0"
|
|
@@ -5269,13 +5269,13 @@
|
|
|
5269
5269
|
}
|
|
5270
5270
|
},
|
|
5271
5271
|
"node_modules/@typescript-eslint/type-utils": {
|
|
5272
|
-
"version": "6.
|
|
5273
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.
|
|
5274
|
-
"integrity": "sha512-
|
|
5272
|
+
"version": "6.18.1",
|
|
5273
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz",
|
|
5274
|
+
"integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==",
|
|
5275
5275
|
"dev": true,
|
|
5276
5276
|
"dependencies": {
|
|
5277
|
-
"@typescript-eslint/typescript-estree": "6.
|
|
5278
|
-
"@typescript-eslint/utils": "6.
|
|
5277
|
+
"@typescript-eslint/typescript-estree": "6.18.1",
|
|
5278
|
+
"@typescript-eslint/utils": "6.18.1",
|
|
5279
5279
|
"debug": "^4.3.4",
|
|
5280
5280
|
"ts-api-utils": "^1.0.1"
|
|
5281
5281
|
},
|
|
@@ -5296,9 +5296,9 @@
|
|
|
5296
5296
|
}
|
|
5297
5297
|
},
|
|
5298
5298
|
"node_modules/@typescript-eslint/types": {
|
|
5299
|
-
"version": "6.
|
|
5300
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.
|
|
5301
|
-
"integrity": "sha512-
|
|
5299
|
+
"version": "6.18.1",
|
|
5300
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz",
|
|
5301
|
+
"integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==",
|
|
5302
5302
|
"dev": true,
|
|
5303
5303
|
"engines": {
|
|
5304
5304
|
"node": "^16.0.0 || >=18.0.0"
|
|
@@ -5309,13 +5309,13 @@
|
|
|
5309
5309
|
}
|
|
5310
5310
|
},
|
|
5311
5311
|
"node_modules/@typescript-eslint/typescript-estree": {
|
|
5312
|
-
"version": "6.
|
|
5313
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.
|
|
5314
|
-
"integrity": "sha512-
|
|
5312
|
+
"version": "6.18.1",
|
|
5313
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz",
|
|
5314
|
+
"integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==",
|
|
5315
5315
|
"dev": true,
|
|
5316
5316
|
"dependencies": {
|
|
5317
|
-
"@typescript-eslint/types": "6.
|
|
5318
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
5317
|
+
"@typescript-eslint/types": "6.18.1",
|
|
5318
|
+
"@typescript-eslint/visitor-keys": "6.18.1",
|
|
5319
5319
|
"debug": "^4.3.4",
|
|
5320
5320
|
"globby": "^11.1.0",
|
|
5321
5321
|
"is-glob": "^4.0.3",
|
|
@@ -5361,17 +5361,17 @@
|
|
|
5361
5361
|
}
|
|
5362
5362
|
},
|
|
5363
5363
|
"node_modules/@typescript-eslint/utils": {
|
|
5364
|
-
"version": "6.
|
|
5365
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.
|
|
5366
|
-
"integrity": "sha512-
|
|
5364
|
+
"version": "6.18.1",
|
|
5365
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz",
|
|
5366
|
+
"integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==",
|
|
5367
5367
|
"dev": true,
|
|
5368
5368
|
"dependencies": {
|
|
5369
5369
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
5370
5370
|
"@types/json-schema": "^7.0.12",
|
|
5371
5371
|
"@types/semver": "^7.5.0",
|
|
5372
|
-
"@typescript-eslint/scope-manager": "6.
|
|
5373
|
-
"@typescript-eslint/types": "6.
|
|
5374
|
-
"@typescript-eslint/typescript-estree": "6.
|
|
5372
|
+
"@typescript-eslint/scope-manager": "6.18.1",
|
|
5373
|
+
"@typescript-eslint/types": "6.18.1",
|
|
5374
|
+
"@typescript-eslint/typescript-estree": "6.18.1",
|
|
5375
5375
|
"semver": "^7.5.4"
|
|
5376
5376
|
},
|
|
5377
5377
|
"engines": {
|
|
@@ -5386,12 +5386,12 @@
|
|
|
5386
5386
|
}
|
|
5387
5387
|
},
|
|
5388
5388
|
"node_modules/@typescript-eslint/visitor-keys": {
|
|
5389
|
-
"version": "6.
|
|
5390
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.
|
|
5391
|
-
"integrity": "sha512
|
|
5389
|
+
"version": "6.18.1",
|
|
5390
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz",
|
|
5391
|
+
"integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==",
|
|
5392
5392
|
"dev": true,
|
|
5393
5393
|
"dependencies": {
|
|
5394
|
-
"@typescript-eslint/types": "6.
|
|
5394
|
+
"@typescript-eslint/types": "6.18.1",
|
|
5395
5395
|
"eslint-visitor-keys": "^3.4.1"
|
|
5396
5396
|
},
|
|
5397
5397
|
"engines": {
|
|
@@ -13505,13 +13505,13 @@
|
|
|
13505
13505
|
}
|
|
13506
13506
|
},
|
|
13507
13507
|
"node_modules/prettier-plugin-packagejson": {
|
|
13508
|
-
"version": "2.4.
|
|
13509
|
-
"resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.4.
|
|
13510
|
-
"integrity": "sha512-
|
|
13508
|
+
"version": "2.4.9",
|
|
13509
|
+
"resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.4.9.tgz",
|
|
13510
|
+
"integrity": "sha512-b3Q7agXVqxK3UpYEJr0xLD51SxriYXESWUCjmxOBUGqnPFZOg9jZGZ+Ptzq252I6OqzXN2rj1tJIFq6KOGLLJw==",
|
|
13511
13511
|
"dev": true,
|
|
13512
13512
|
"dependencies": {
|
|
13513
13513
|
"sort-package-json": "2.6.0",
|
|
13514
|
-
"synckit": "0.
|
|
13514
|
+
"synckit": "0.9.0"
|
|
13515
13515
|
},
|
|
13516
13516
|
"peerDependencies": {
|
|
13517
13517
|
"prettier": ">= 1.16.0"
|
|
@@ -15379,9 +15379,9 @@
|
|
|
15379
15379
|
}
|
|
15380
15380
|
},
|
|
15381
15381
|
"node_modules/synckit": {
|
|
15382
|
-
"version": "0.
|
|
15383
|
-
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.
|
|
15384
|
-
"integrity": "sha512-
|
|
15382
|
+
"version": "0.9.0",
|
|
15383
|
+
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.0.tgz",
|
|
15384
|
+
"integrity": "sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==",
|
|
15385
15385
|
"dev": true,
|
|
15386
15386
|
"dependencies": {
|
|
15387
15387
|
"@pkgr/core": "^0.1.0",
|
|
@@ -20024,47 +20024,47 @@
|
|
|
20024
20024
|
"dev": true
|
|
20025
20025
|
},
|
|
20026
20026
|
"@sentry-internal/tracing": {
|
|
20027
|
-
"version": "7.
|
|
20028
|
-
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.
|
|
20029
|
-
"integrity": "sha512-
|
|
20027
|
+
"version": "7.93.0",
|
|
20028
|
+
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.93.0.tgz",
|
|
20029
|
+
"integrity": "sha512-DjuhmQNywPp+8fxC9dvhGrqgsUb6wI/HQp25lS2Re7VxL1swCasvpkg8EOYP4iBniVQ86QK0uITkOIRc5tdY1w==",
|
|
20030
20030
|
"requires": {
|
|
20031
|
-
"@sentry/core": "7.
|
|
20032
|
-
"@sentry/types": "7.
|
|
20033
|
-
"@sentry/utils": "7.
|
|
20031
|
+
"@sentry/core": "7.93.0",
|
|
20032
|
+
"@sentry/types": "7.93.0",
|
|
20033
|
+
"@sentry/utils": "7.93.0"
|
|
20034
20034
|
}
|
|
20035
20035
|
},
|
|
20036
20036
|
"@sentry/core": {
|
|
20037
|
-
"version": "7.
|
|
20038
|
-
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.
|
|
20039
|
-
"integrity": "sha512-
|
|
20037
|
+
"version": "7.93.0",
|
|
20038
|
+
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.93.0.tgz",
|
|
20039
|
+
"integrity": "sha512-vZQSUiDn73n+yu2fEcH+Wpm4GbRmtxmnXnYCPgM6IjnXqkVm3awWAkzrheADblx3kmxrRiOlTXYHw9NTWs56fg==",
|
|
20040
20040
|
"requires": {
|
|
20041
|
-
"@sentry/types": "7.
|
|
20042
|
-
"@sentry/utils": "7.
|
|
20041
|
+
"@sentry/types": "7.93.0",
|
|
20042
|
+
"@sentry/utils": "7.93.0"
|
|
20043
20043
|
}
|
|
20044
20044
|
},
|
|
20045
20045
|
"@sentry/node": {
|
|
20046
|
-
"version": "7.
|
|
20047
|
-
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.
|
|
20048
|
-
"integrity": "sha512-
|
|
20049
|
-
"requires": {
|
|
20050
|
-
"@sentry-internal/tracing": "7.
|
|
20051
|
-
"@sentry/core": "7.
|
|
20052
|
-
"@sentry/types": "7.
|
|
20053
|
-
"@sentry/utils": "7.
|
|
20046
|
+
"version": "7.93.0",
|
|
20047
|
+
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.93.0.tgz",
|
|
20048
|
+
"integrity": "sha512-nUXPCZQm5Y9Ipv7iWXLNp5dbuyi1VvbJ3RtlwD7utgsNkRYB4ixtKE9w2QU8DZZAjaEF6w2X94OkYH6C932FWw==",
|
|
20049
|
+
"requires": {
|
|
20050
|
+
"@sentry-internal/tracing": "7.93.0",
|
|
20051
|
+
"@sentry/core": "7.93.0",
|
|
20052
|
+
"@sentry/types": "7.93.0",
|
|
20053
|
+
"@sentry/utils": "7.93.0",
|
|
20054
20054
|
"https-proxy-agent": "^5.0.0"
|
|
20055
20055
|
}
|
|
20056
20056
|
},
|
|
20057
20057
|
"@sentry/types": {
|
|
20058
|
-
"version": "7.
|
|
20059
|
-
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.
|
|
20060
|
-
"integrity": "sha512-
|
|
20058
|
+
"version": "7.93.0",
|
|
20059
|
+
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.93.0.tgz",
|
|
20060
|
+
"integrity": "sha512-UnzUccNakhFRA/esWBWP+0v7cjNg+RilFBQC03Mv9OEMaZaS29zSbcOGtRzuFOXXLBdbr44BWADqpz3VW0XaNw=="
|
|
20061
20061
|
},
|
|
20062
20062
|
"@sentry/utils": {
|
|
20063
|
-
"version": "7.
|
|
20064
|
-
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.
|
|
20065
|
-
"integrity": "sha512-
|
|
20063
|
+
"version": "7.93.0",
|
|
20064
|
+
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.93.0.tgz",
|
|
20065
|
+
"integrity": "sha512-Iovj7tUnbgSkh/WrAaMrd5UuYjW7AzyzZlFDIUrwidsyIdUficjCG2OIxYzh76H6nYIx9SxewW0R54Q6XoB4uA==",
|
|
20066
20066
|
"requires": {
|
|
20067
|
-
"@sentry/types": "7.
|
|
20067
|
+
"@sentry/types": "7.93.0"
|
|
20068
20068
|
}
|
|
20069
20069
|
},
|
|
20070
20070
|
"@sinclair/typebox": {
|
|
@@ -20292,9 +20292,9 @@
|
|
|
20292
20292
|
}
|
|
20293
20293
|
},
|
|
20294
20294
|
"@types/eslint": {
|
|
20295
|
-
"version": "8.56.
|
|
20296
|
-
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.
|
|
20297
|
-
"integrity": "sha512-
|
|
20295
|
+
"version": "8.56.2",
|
|
20296
|
+
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz",
|
|
20297
|
+
"integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==",
|
|
20298
20298
|
"dev": true,
|
|
20299
20299
|
"requires": {
|
|
20300
20300
|
"@types/estree": "*",
|
|
@@ -20392,9 +20392,9 @@
|
|
|
20392
20392
|
"dev": true
|
|
20393
20393
|
},
|
|
20394
20394
|
"@types/node": {
|
|
20395
|
-
"version": "18.19.
|
|
20396
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.
|
|
20397
|
-
"integrity": "sha512-
|
|
20395
|
+
"version": "18.19.6",
|
|
20396
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.6.tgz",
|
|
20397
|
+
"integrity": "sha512-X36s5CXMrrJOs2lQCdDF68apW4Rfx9ixYMawlepwmE4Anezv/AV2LSpKD1Ub8DAc+urp5bk0BGZ6NtmBitfnsg==",
|
|
20398
20398
|
"dev": true,
|
|
20399
20399
|
"requires": {
|
|
20400
20400
|
"undici-types": "~5.26.4"
|
|
@@ -20493,16 +20493,16 @@
|
|
|
20493
20493
|
}
|
|
20494
20494
|
},
|
|
20495
20495
|
"@typescript-eslint/eslint-plugin": {
|
|
20496
|
-
"version": "6.
|
|
20497
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.
|
|
20498
|
-
"integrity": "sha512-
|
|
20496
|
+
"version": "6.18.1",
|
|
20497
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz",
|
|
20498
|
+
"integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==",
|
|
20499
20499
|
"dev": true,
|
|
20500
20500
|
"requires": {
|
|
20501
20501
|
"@eslint-community/regexpp": "^4.5.1",
|
|
20502
|
-
"@typescript-eslint/scope-manager": "6.
|
|
20503
|
-
"@typescript-eslint/type-utils": "6.
|
|
20504
|
-
"@typescript-eslint/utils": "6.
|
|
20505
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
20502
|
+
"@typescript-eslint/scope-manager": "6.18.1",
|
|
20503
|
+
"@typescript-eslint/type-utils": "6.18.1",
|
|
20504
|
+
"@typescript-eslint/utils": "6.18.1",
|
|
20505
|
+
"@typescript-eslint/visitor-keys": "6.18.1",
|
|
20506
20506
|
"debug": "^4.3.4",
|
|
20507
20507
|
"graphemer": "^1.4.0",
|
|
20508
20508
|
"ignore": "^5.2.4",
|
|
@@ -20512,54 +20512,54 @@
|
|
|
20512
20512
|
}
|
|
20513
20513
|
},
|
|
20514
20514
|
"@typescript-eslint/parser": {
|
|
20515
|
-
"version": "6.
|
|
20516
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.
|
|
20517
|
-
"integrity": "sha512-
|
|
20515
|
+
"version": "6.18.1",
|
|
20516
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz",
|
|
20517
|
+
"integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==",
|
|
20518
20518
|
"dev": true,
|
|
20519
20519
|
"requires": {
|
|
20520
|
-
"@typescript-eslint/scope-manager": "6.
|
|
20521
|
-
"@typescript-eslint/types": "6.
|
|
20522
|
-
"@typescript-eslint/typescript-estree": "6.
|
|
20523
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
20520
|
+
"@typescript-eslint/scope-manager": "6.18.1",
|
|
20521
|
+
"@typescript-eslint/types": "6.18.1",
|
|
20522
|
+
"@typescript-eslint/typescript-estree": "6.18.1",
|
|
20523
|
+
"@typescript-eslint/visitor-keys": "6.18.1",
|
|
20524
20524
|
"debug": "^4.3.4"
|
|
20525
20525
|
}
|
|
20526
20526
|
},
|
|
20527
20527
|
"@typescript-eslint/scope-manager": {
|
|
20528
|
-
"version": "6.
|
|
20529
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.
|
|
20530
|
-
"integrity": "sha512-
|
|
20528
|
+
"version": "6.18.1",
|
|
20529
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz",
|
|
20530
|
+
"integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==",
|
|
20531
20531
|
"dev": true,
|
|
20532
20532
|
"requires": {
|
|
20533
|
-
"@typescript-eslint/types": "6.
|
|
20534
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
20533
|
+
"@typescript-eslint/types": "6.18.1",
|
|
20534
|
+
"@typescript-eslint/visitor-keys": "6.18.1"
|
|
20535
20535
|
}
|
|
20536
20536
|
},
|
|
20537
20537
|
"@typescript-eslint/type-utils": {
|
|
20538
|
-
"version": "6.
|
|
20539
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.
|
|
20540
|
-
"integrity": "sha512-
|
|
20538
|
+
"version": "6.18.1",
|
|
20539
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz",
|
|
20540
|
+
"integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==",
|
|
20541
20541
|
"dev": true,
|
|
20542
20542
|
"requires": {
|
|
20543
|
-
"@typescript-eslint/typescript-estree": "6.
|
|
20544
|
-
"@typescript-eslint/utils": "6.
|
|
20543
|
+
"@typescript-eslint/typescript-estree": "6.18.1",
|
|
20544
|
+
"@typescript-eslint/utils": "6.18.1",
|
|
20545
20545
|
"debug": "^4.3.4",
|
|
20546
20546
|
"ts-api-utils": "^1.0.1"
|
|
20547
20547
|
}
|
|
20548
20548
|
},
|
|
20549
20549
|
"@typescript-eslint/types": {
|
|
20550
|
-
"version": "6.
|
|
20551
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.
|
|
20552
|
-
"integrity": "sha512-
|
|
20550
|
+
"version": "6.18.1",
|
|
20551
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz",
|
|
20552
|
+
"integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==",
|
|
20553
20553
|
"dev": true
|
|
20554
20554
|
},
|
|
20555
20555
|
"@typescript-eslint/typescript-estree": {
|
|
20556
|
-
"version": "6.
|
|
20557
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.
|
|
20558
|
-
"integrity": "sha512-
|
|
20556
|
+
"version": "6.18.1",
|
|
20557
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz",
|
|
20558
|
+
"integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==",
|
|
20559
20559
|
"dev": true,
|
|
20560
20560
|
"requires": {
|
|
20561
|
-
"@typescript-eslint/types": "6.
|
|
20562
|
-
"@typescript-eslint/visitor-keys": "6.
|
|
20561
|
+
"@typescript-eslint/types": "6.18.1",
|
|
20562
|
+
"@typescript-eslint/visitor-keys": "6.18.1",
|
|
20563
20563
|
"debug": "^4.3.4",
|
|
20564
20564
|
"globby": "^11.1.0",
|
|
20565
20565
|
"is-glob": "^4.0.3",
|
|
@@ -20589,27 +20589,27 @@
|
|
|
20589
20589
|
}
|
|
20590
20590
|
},
|
|
20591
20591
|
"@typescript-eslint/utils": {
|
|
20592
|
-
"version": "6.
|
|
20593
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.
|
|
20594
|
-
"integrity": "sha512-
|
|
20592
|
+
"version": "6.18.1",
|
|
20593
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz",
|
|
20594
|
+
"integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==",
|
|
20595
20595
|
"dev": true,
|
|
20596
20596
|
"requires": {
|
|
20597
20597
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
20598
20598
|
"@types/json-schema": "^7.0.12",
|
|
20599
20599
|
"@types/semver": "^7.5.0",
|
|
20600
|
-
"@typescript-eslint/scope-manager": "6.
|
|
20601
|
-
"@typescript-eslint/types": "6.
|
|
20602
|
-
"@typescript-eslint/typescript-estree": "6.
|
|
20600
|
+
"@typescript-eslint/scope-manager": "6.18.1",
|
|
20601
|
+
"@typescript-eslint/types": "6.18.1",
|
|
20602
|
+
"@typescript-eslint/typescript-estree": "6.18.1",
|
|
20603
20603
|
"semver": "^7.5.4"
|
|
20604
20604
|
}
|
|
20605
20605
|
},
|
|
20606
20606
|
"@typescript-eslint/visitor-keys": {
|
|
20607
|
-
"version": "6.
|
|
20608
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.
|
|
20609
|
-
"integrity": "sha512
|
|
20607
|
+
"version": "6.18.1",
|
|
20608
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz",
|
|
20609
|
+
"integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==",
|
|
20610
20610
|
"dev": true,
|
|
20611
20611
|
"requires": {
|
|
20612
|
-
"@typescript-eslint/types": "6.
|
|
20612
|
+
"@typescript-eslint/types": "6.18.1",
|
|
20613
20613
|
"eslint-visitor-keys": "^3.4.1"
|
|
20614
20614
|
}
|
|
20615
20615
|
},
|
|
@@ -26260,13 +26260,13 @@
|
|
|
26260
26260
|
"requires": {}
|
|
26261
26261
|
},
|
|
26262
26262
|
"prettier-plugin-packagejson": {
|
|
26263
|
-
"version": "2.4.
|
|
26264
|
-
"resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.4.
|
|
26265
|
-
"integrity": "sha512-
|
|
26263
|
+
"version": "2.4.9",
|
|
26264
|
+
"resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.4.9.tgz",
|
|
26265
|
+
"integrity": "sha512-b3Q7agXVqxK3UpYEJr0xLD51SxriYXESWUCjmxOBUGqnPFZOg9jZGZ+Ptzq252I6OqzXN2rj1tJIFq6KOGLLJw==",
|
|
26266
26266
|
"dev": true,
|
|
26267
26267
|
"requires": {
|
|
26268
26268
|
"sort-package-json": "2.6.0",
|
|
26269
|
-
"synckit": "0.
|
|
26269
|
+
"synckit": "0.9.0"
|
|
26270
26270
|
}
|
|
26271
26271
|
},
|
|
26272
26272
|
"pretty-format": {
|
|
@@ -27636,9 +27636,9 @@
|
|
|
27636
27636
|
}
|
|
27637
27637
|
},
|
|
27638
27638
|
"synckit": {
|
|
27639
|
-
"version": "0.
|
|
27640
|
-
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.
|
|
27641
|
-
"integrity": "sha512-
|
|
27639
|
+
"version": "0.9.0",
|
|
27640
|
+
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.0.tgz",
|
|
27641
|
+
"integrity": "sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==",
|
|
27642
27642
|
"dev": true,
|
|
27643
27643
|
"requires": {
|
|
27644
27644
|
"@pkgr/core": "^0.1.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadgetinc/ggt",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "The command-line interface for Gadget",
|
|
5
5
|
"homepage": "https://github.com/gadget-inc/ggt",
|
|
6
6
|
"bugs": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"version": "changeset version && npm install --package-lock-only && ./scripts/generate-readme.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@sentry/node": "^7.
|
|
47
|
+
"@sentry/node": "^7.93.0",
|
|
48
48
|
"@swc/helpers": "^0.5.3",
|
|
49
49
|
"arg": "^5.0.2",
|
|
50
50
|
"boxen": "^7.1.1",
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
"@swc-node/register": "^1.6.8",
|
|
95
95
|
"@swc/cli": "^0.1.63",
|
|
96
96
|
"@swc/core": "^1.3.102",
|
|
97
|
-
"@types/eslint": "^8.56.
|
|
97
|
+
"@types/eslint": "^8.56.2",
|
|
98
98
|
"@types/fast-levenshtein": "^0.0.4",
|
|
99
99
|
"@types/fs-extra": "^11.0.4",
|
|
100
100
|
"@types/ms": "^0.7.34",
|
|
101
|
-
"@types/node": "^18.19.
|
|
101
|
+
"@types/node": "^18.19.6",
|
|
102
102
|
"@types/node-notifier": "^8.0.5",
|
|
103
103
|
"@types/normalize-path": "^3.0.2",
|
|
104
104
|
"@types/pluralize": "^0.0.33",
|
|
105
105
|
"@types/prompts": "^2.4.9",
|
|
106
106
|
"@types/which": "^3.0.3",
|
|
107
107
|
"@types/ws": "^8.5.10",
|
|
108
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
109
|
-
"@typescript-eslint/parser": "^6.
|
|
108
|
+
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
109
|
+
"@typescript-eslint/parser": "^6.18.1",
|
|
110
110
|
"concurrently": "^8.2.2",
|
|
111
111
|
"cspell": "^7.3.8",
|
|
112
112
|
"eslint": "^8.56.0",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"nock": "^13.4.0",
|
|
121
121
|
"prettier": "^3.1.1",
|
|
122
122
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
123
|
-
"prettier-plugin-packagejson": "^2.4.
|
|
123
|
+
"prettier-plugin-packagejson": "^2.4.9",
|
|
124
124
|
"remark": "^15.0.1",
|
|
125
125
|
"remark-gfm": "^4.0.0",
|
|
126
126
|
"remark-toc": "^9.0.0",
|