@gadgetinc/ggt 0.3.3 → 0.4.1
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 +139 -76
- package/bin/dev.js +4 -7
- package/lib/__generated__/graphql.js.map +1 -1
- package/lib/commands/deploy.js +232 -0
- package/lib/commands/deploy.js.map +1 -0
- package/lib/commands/list.js +20 -16
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/login.js +22 -20
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.js +13 -9
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/root.js +89 -56
- package/lib/commands/root.js.map +1 -1
- package/lib/commands/sync.js +253 -496
- package/lib/commands/sync.js.map +1 -1
- package/lib/commands/version.js +21 -0
- package/lib/commands/version.js.map +1 -0
- package/lib/commands/whoami.js +15 -11
- package/lib/commands/whoami.js.map +1 -1
- package/lib/main.js +4 -10
- package/lib/main.js.map +1 -1
- package/lib/services/{app.js → app/app.js} +8 -3
- package/lib/services/app/app.js.map +1 -0
- package/lib/services/app/arg.js +28 -0
- package/lib/services/app/arg.js.map +1 -0
- package/lib/services/app/edit-graphql.js +389 -0
- package/lib/services/app/edit-graphql.js.map +1 -0
- package/lib/services/command/arg.js +53 -0
- package/lib/services/command/arg.js.map +1 -0
- package/lib/services/command/command.js +27 -0
- package/lib/services/command/command.js.map +1 -0
- package/lib/services/command/context.js +60 -0
- package/lib/services/command/context.js.map +1 -0
- package/lib/services/{config.js → config/config.js} +29 -31
- package/lib/services/config/config.js.map +1 -0
- package/lib/services/config/env.js +22 -0
- package/lib/services/config/env.js.map +1 -0
- package/lib/services/config/package-json.js +9 -0
- package/lib/services/config/package-json.js.map +1 -0
- package/lib/services/filesync/changes.js +97 -0
- package/lib/services/filesync/changes.js.map +1 -0
- package/lib/services/filesync/conflicts.js +137 -0
- package/lib/services/filesync/conflicts.js.map +1 -0
- package/lib/services/filesync/directory.js +253 -0
- package/lib/services/filesync/directory.js.map +1 -0
- package/lib/services/filesync/error.js +67 -0
- package/lib/services/filesync/error.js.map +1 -0
- package/lib/services/filesync/file.js +3 -0
- package/lib/services/filesync/file.js.map +1 -0
- package/lib/services/filesync/filesync.js +673 -0
- package/lib/services/filesync/filesync.js.map +1 -0
- package/lib/services/filesync/hashes.js +150 -0
- package/lib/services/filesync/hashes.js.map +1 -0
- package/lib/services/http/auth.js +41 -0
- package/lib/services/http/auth.js.map +1 -0
- package/lib/services/http/http.js +64 -0
- package/lib/services/http/http.js.map +1 -0
- package/lib/services/output/log/field.js +3 -0
- package/lib/services/output/log/field.js.map +1 -0
- package/lib/services/output/log/format/format.js +8 -0
- package/lib/services/output/log/format/format.js.map +1 -0
- package/lib/services/output/log/format/json.js +45 -0
- package/lib/services/output/log/format/json.js.map +1 -0
- package/lib/services/output/log/format/pretty.js +147 -0
- package/lib/services/output/log/format/pretty.js.map +1 -0
- package/lib/services/output/log/level.js +41 -0
- package/lib/services/output/log/level.js.map +1 -0
- package/lib/services/output/log/logger.js +40 -0
- package/lib/services/output/log/logger.js.map +1 -0
- package/lib/services/output/log/printer.js +120 -0
- package/lib/services/output/log/printer.js.map +1 -0
- package/lib/services/output/log/structured.js +52 -0
- package/lib/services/output/log/structured.js.map +1 -0
- package/lib/services/{notify.js → output/notify.js} +7 -6
- package/lib/services/output/notify.js.map +1 -0
- package/lib/services/output/prompt.js +52 -0
- package/lib/services/output/prompt.js.map +1 -0
- package/lib/services/output/report.js +162 -0
- package/lib/services/output/report.js.map +1 -0
- package/lib/services/output/sprint.js +21 -0
- package/lib/services/output/sprint.js.map +1 -0
- package/lib/services/output/stream.js +54 -0
- package/lib/services/output/stream.js.map +1 -0
- package/lib/services/{version.js → output/update.js} +24 -16
- package/lib/services/output/update.js.map +1 -0
- package/lib/services/user/session.js +50 -0
- package/lib/services/user/session.js.map +1 -0
- package/lib/services/{user.js → user/user.js} +23 -14
- package/lib/services/user/user.js.map +1 -0
- package/lib/services/util/boolean.js +15 -0
- package/lib/services/util/boolean.js.map +1 -0
- package/lib/services/util/collection.js +38 -0
- package/lib/services/util/collection.js.map +1 -0
- package/lib/services/util/function.js +97 -0
- package/lib/services/util/function.js.map +1 -0
- package/lib/services/{is.js → util/is.js} +7 -0
- package/lib/services/util/is.js.map +1 -0
- package/lib/services/util/number.js +27 -0
- package/lib/services/util/number.js.map +1 -0
- package/lib/services/util/object.js +101 -0
- package/lib/services/util/object.js.map +1 -0
- package/lib/services/util/paths.js +36 -0
- package/lib/services/util/paths.js.map +1 -0
- package/lib/services/{promise.js → util/promise.js} +5 -7
- package/lib/services/util/promise.js.map +1 -0
- package/npm-shrinkwrap.json +2143 -1304
- package/package.json +50 -42
- package/lib/commands/index.js +0 -9
- package/lib/commands/index.js.map +0 -1
- package/lib/services/app.js.map +0 -1
- package/lib/services/args.js +0 -28
- package/lib/services/args.js.map +0 -1
- package/lib/services/collections.js +0 -17
- package/lib/services/collections.js.map +0 -1
- package/lib/services/config.js.map +0 -1
- package/lib/services/debounce.js +0 -21
- package/lib/services/debounce.js.map +0 -1
- package/lib/services/defaults.js +0 -8
- package/lib/services/defaults.js.map +0 -1
- package/lib/services/edit-graphql.js +0 -202
- package/lib/services/edit-graphql.js.map +0 -1
- package/lib/services/errors.js +0 -277
- package/lib/services/errors.js.map +0 -1
- package/lib/services/filesync.js +0 -404
- package/lib/services/filesync.js.map +0 -1
- package/lib/services/fs.js +0 -35
- package/lib/services/fs.js.map +0 -1
- package/lib/services/http.js +0 -53
- package/lib/services/http.js.map +0 -1
- package/lib/services/is.js.map +0 -1
- package/lib/services/log.js +0 -45
- package/lib/services/log.js.map +0 -1
- package/lib/services/noop.js +0 -4
- package/lib/services/noop.js.map +0 -1
- package/lib/services/notify.js.map +0 -1
- package/lib/services/output.js +0 -74
- package/lib/services/output.js.map +0 -1
- package/lib/services/promise.js.map +0 -1
- package/lib/services/prompt.js +0 -22
- package/lib/services/prompt.js.map +0 -1
- package/lib/services/session.js +0 -31
- package/lib/services/session.js.map +0 -1
- package/lib/services/sleep.js +0 -21
- package/lib/services/sleep.js.map +0 -1
- package/lib/services/timeout.js +0 -8
- package/lib/services/timeout.js.map +0 -1
- package/lib/services/user.js.map +0 -1
- package/lib/services/version.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the filename of the current module.
|
|
5
|
+
*
|
|
6
|
+
* @returns {string} The filename of the current module.
|
|
7
|
+
*/ export const thisFilename = ()=>fileURLToPath(import.meta.url);
|
|
8
|
+
/**
|
|
9
|
+
* Returns the directory name of the current module.
|
|
10
|
+
*
|
|
11
|
+
* @returns {string} The directory name of the current module.
|
|
12
|
+
*/ export const thisDirname = ()=>path.dirname(thisFilename());
|
|
13
|
+
/**
|
|
14
|
+
* Returns a path relative to the current module.
|
|
15
|
+
*
|
|
16
|
+
* @param {string[]} segments The segments of the path.
|
|
17
|
+
* @returns {string} The path relative to the current module.
|
|
18
|
+
*/ export const relativeToThisFile = (...segments)=>path.join(thisDirname(), ...segments);
|
|
19
|
+
/**
|
|
20
|
+
* The root directory of the ggt package.
|
|
21
|
+
*/ export const workspaceRoot = relativeToThisFile("../../../");
|
|
22
|
+
/**
|
|
23
|
+
* Returns an absolute path within the ggt package.
|
|
24
|
+
*
|
|
25
|
+
* @param segments - The segments of the path to join.
|
|
26
|
+
* @returns The absolute path to the file or directory.
|
|
27
|
+
*/ export const workspacePath = (...segments)=>path.join(workspaceRoot, ...segments);
|
|
28
|
+
/**
|
|
29
|
+
* Returns an absolute path within the `assets` directory of the ggt
|
|
30
|
+
* package.
|
|
31
|
+
*
|
|
32
|
+
* @param segments - The segments of the path to join.
|
|
33
|
+
* @returns The absolute path to the file or directory.
|
|
34
|
+
*/ export const assetsPath = (...segments)=>workspacePath("assets", ...segments);
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/services/util/paths.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Returns the filename of the current module.\n *\n * @returns {string} The filename of the current module.\n */\nexport const thisFilename = (): string => fileURLToPath(import.meta.url);\n\n/**\n * Returns the directory name of the current module.\n *\n * @returns {string} The directory name of the current module.\n */\nexport const thisDirname = (): string => path.dirname(thisFilename());\n\n/**\n * Returns a path relative to the current module.\n *\n * @param {string[]} segments The segments of the path.\n * @returns {string} The path relative to the current module.\n */\nexport const relativeToThisFile = (...segments: string[]): string => path.join(thisDirname(), ...segments);\n\n/**\n * The root directory of the ggt package.\n */\nexport const workspaceRoot = relativeToThisFile(\"../../../\");\n\n/**\n * Returns an absolute path within the ggt package.\n *\n * @param segments - The segments of the path to join.\n * @returns The absolute path to the file or directory.\n */\nexport const workspacePath = (...segments: string[]): string => path.join(workspaceRoot, ...segments);\n\n/**\n * Returns an absolute path within the `assets` directory of the ggt\n * package.\n *\n * @param segments - The segments of the path to join.\n * @returns The absolute path to the file or directory.\n */\nexport const assetsPath = (...segments: string[]): string => workspacePath(\"assets\", ...segments);\n"],"names":["path","fileURLToPath","thisFilename","url","thisDirname","dirname","relativeToThisFile","segments","join","workspaceRoot","workspacePath","assetsPath"],"mappings":"AAAA,OAAOA,UAAU,YAAY;AAC7B,SAASC,aAAa,QAAQ,WAAW;AAEzC;;;;CAIC,GACD,OAAO,MAAMC,eAAe,IAAcD,cAAc,YAAYE,GAAG,EAAE;AAEzE;;;;CAIC,GACD,OAAO,MAAMC,cAAc,IAAcJ,KAAKK,OAAO,CAACH,gBAAgB;AAEtE;;;;;CAKC,GACD,OAAO,MAAMI,qBAAqB,CAAC,GAAGC,WAA+BP,KAAKQ,IAAI,CAACJ,kBAAkBG,UAAU;AAE3G;;CAEC,GACD,OAAO,MAAME,gBAAgBH,mBAAmB,aAAa;AAE7D;;;;;CAKC,GACD,OAAO,MAAMI,gBAAgB,CAAC,GAAGH,WAA+BP,KAAKQ,IAAI,CAACC,kBAAkBF,UAAU;AAEtG;;;;;;CAMC,GACD,OAAO,MAAMI,aAAa,CAAC,GAAGJ,WAA+BG,cAAc,aAAaH,UAAU"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
-
import assert from "node:assert";
|
|
3
1
|
/**
|
|
4
2
|
* Long lived references to Promises stress the garbage collector in JS.
|
|
5
3
|
*
|
|
6
4
|
* Instead of caching resolved Promises, we cache these little data
|
|
7
5
|
* objects instead which reference the resolution or rejection of the
|
|
8
6
|
* Promise, allowing the Promise object to be free'd.
|
|
9
|
-
*/
|
|
7
|
+
*/ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
8
|
+
export class PromiseWrapper {
|
|
10
9
|
async unwrap() {
|
|
11
|
-
if (this.
|
|
12
|
-
return this.
|
|
10
|
+
if (this.pendingPromise) {
|
|
11
|
+
return await this.pendingPromise;
|
|
13
12
|
} else if (this.rejection) {
|
|
14
13
|
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
15
14
|
throw this.rejection;
|
|
16
15
|
} else {
|
|
17
|
-
|
|
18
|
-
return await this.pendingPromise;
|
|
16
|
+
return this.resolution;
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
constructor(promise){
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/services/util/promise.ts"],"sourcesContent":["/**\n * Long lived references to Promises stress the garbage collector in JS.\n *\n * Instead of caching resolved Promises, we cache these little data\n * objects instead which reference the resolution or rejection of the\n * Promise, allowing the Promise object to be free'd.\n */\nexport class PromiseWrapper<T> {\n resolution?: T;\n rejection?: unknown;\n pendingPromise?: Promise<T>;\n\n constructor(promise: Promise<T>) {\n this.pendingPromise = promise;\n\n promise\n .then((res) => {\n this.resolution = res;\n return res;\n })\n .catch((err) => {\n this.rejection = err;\n })\n .finally(() => {\n delete this.pendingPromise;\n });\n }\n\n async unwrap(): Promise<T> {\n if (this.pendingPromise) {\n return await this.pendingPromise;\n } else if (this.rejection) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw this.rejection;\n } else {\n return this.resolution as T;\n }\n }\n}\n\n/**\n * A promise that can be resolved or rejected from outside its callback.\n *\n * This is typically used when you want to await a promise that is\n * resolved or rejected from outside the current scope, such as from an\n * event handler.\n *\n * @example\n * const signal = new PromiseSignal();\n * process.on(\"SIGINT\", () => {\n * signal.resolve();\n * });\n * await signal;\n */\nexport class PromiseSignal<T = void> implements Promise<T> {\n readonly [Symbol.toStringTag]!: string;\n\n resolve!: (value: T | PromiseLike<T>) => void;\n reject!: (reason?: unknown) => void;\n\n private _promise: PromiseWrapper<T>;\n\n constructor() {\n this._promise = new PromiseWrapper<T>(\n new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n }),\n );\n\n this[Symbol.toStringTag] = String(this._promise.pendingPromise);\n }\n\n then<R = T, E = never>(\n onfulfilled?: (value: T) => R | PromiseLike<R>,\n onrejected?: (reason: unknown) => E | PromiseLike<E>,\n ): Promise<R | E> {\n return this._promise.unwrap().then(onfulfilled, onrejected);\n }\n\n catch<E = never>(onrejected?: (reason: unknown) => E | PromiseLike<E>): Promise<T | E> {\n return this._promise.unwrap().catch(onrejected);\n }\n\n finally(onfinally?: () => void): Promise<T> {\n return this._promise.unwrap().finally(onfinally);\n }\n}\n"],"names":["PromiseWrapper","unwrap","pendingPromise","rejection","resolution","constructor","promise","then","res","catch","err","finally","Symbol","toStringTag","PromiseSignal","onfulfilled","onrejected","_promise","onfinally","resolve","reject","Promise","String"],"mappings":"AAAA;;;;;;CAMC;AACD,OAAO,MAAMA;IAqBX,MAAMC,SAAqB;QACzB,IAAI,IAAI,CAACC,cAAc,EAAE;YACvB,OAAO,MAAM,IAAI,CAACA,cAAc;QAClC,OAAO,IAAI,IAAI,CAACC,SAAS,EAAE;YACzB,+DAA+D;YAC/D,MAAM,IAAI,CAACA,SAAS;QACtB,OA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