create-baeta 2.0.0-next.14 → 2.0.0-next.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # create-baeta
2
2
 
3
+ ## 2.0.0-next.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Drop Node v23 and v25 by [@andreisergiu98](https://github.com/andreisergiu98) in [#474](https://github.com/andreisergiu98/baeta/pull/474)
8
+
9
+ - Validate app name by [@andreisergiu98](https://github.com/andreisergiu98) in [#512](https://github.com/andreisergiu98/baeta/pull/512)
10
+
11
+ - Drop prompts dependency in favor of inquirer by [@andreisergiu98](https://github.com/andreisergiu98) in [#418](https://github.com/andreisergiu98/baeta/pull/418)
12
+
13
+ - Check for bun.lock by [@andreisergiu98](https://github.com/andreisergiu98) in [#516](https://github.com/andreisergiu98/baeta/pull/516)
14
+
3
15
  ## 2.0.0-next.14
4
16
 
5
17
  ## 2.0.0-next.13
package/README.md CHANGED
@@ -35,10 +35,11 @@ Building GraphQL APIs shouldn't be complicated. **Baeta** is a modern, modular,
35
35
  - **Middleware & Directives**: Easy integration of custom behaviors
36
36
  - **High Performance**: Built for scalability and efficiency
37
37
 
38
- #### And optional extensions and plugins
38
+ #### And optional app plugins and libraries
39
39
 
40
- - **@baeta/extension-auth**: Add powerful scope-based authorization
41
- - **@baeta/extension-cache**: Implement automatic caching with simple update patterns
40
+ - **@baeta/auth**: Add powerful scope-based authorization
41
+ - **@baeta/complexity**: Reject resource-exhausting queries with depth, breadth and complexity limits
42
+ - **@baeta/cache**: Type-safe caching with declarative queries and automatic reconciliation
42
43
  - ... and more!
43
44
 
44
45
  ## Why use Baeta?
@@ -89,7 +90,7 @@ const usersQuery = Query.users.resolve(() => {
89
90
  return dataSource.user.findMany();
90
91
  });
91
92
 
92
- Query.$fields({
93
+ export default Query.$fields({
93
94
  user: userQuery,
94
95
  users: usersQuery,
95
96
  });
@@ -98,17 +99,13 @@ Query.$fields({
98
99
  #### 3. Add authorization
99
100
 
100
101
  ```typescript
102
+ import { auth, rule, scope } from "./lib/auth.ts";
101
103
  import { UserModule } from "./typedef.ts";
102
104
 
103
105
  const { Query } = UserModule;
104
106
 
105
107
  const userQuery = Query.user
106
- .$auth({
107
- $or: {
108
- isPublic: true,
109
- isLoggedIn: true,
110
- },
111
- })
108
+ .$use(auth(rule.or(scope.isPublic, scope.isLoggedIn)))
112
109
  .resolve(async ({ args }) => {
113
110
  // ...
114
111
  });
@@ -117,23 +114,33 @@ const userQuery = Query.user
117
114
  #### 4. Add caching
118
115
 
119
116
  ```typescript
120
- const { Query, Mutation, User } = UserModule;
121
-
122
- export const userCache = User.$createCache();
123
-
124
- const userQuery = Query.user
125
- .$auth({
126
- // ...
117
+ import { createCache, defineQuery } from "@baeta/cache";
118
+ import { redisClient } from "./lib/redis.ts";
119
+
120
+ const { Query, Mutation } = UserModule;
121
+
122
+ export const userCache = createCache(redisClient, {
123
+ name: "UserCache",
124
+ parse: JSON.parse,
125
+ serialize: JSON.stringify,
126
+ })
127
+ .withQueries({
128
+ findUser: defineQuery({
129
+ resolve: async (args: { id: string }) => {
130
+ return dataSource.user.findUnique({ where: args });
131
+ },
132
+ }),
127
133
  })
128
- .$useCache(userCache)
129
- .resolve(async ({ args }) => {
130
- // ...
131
- });
134
+ .build();
135
+
136
+ const userQuery = Query.user.map(({ args }) =>
137
+ userCache.queries.findUser({ id: args.where.id }),
138
+ );
132
139
 
133
140
  const updateUserMutation = Mutation.updateUser
134
141
  .$use(async (next) => {
135
142
  const user = await next();
136
- await userCache.save(user);
143
+ if (user) await userCache.update(user);
137
144
  return user;
138
145
  })
139
146
  .resolve(async ({ args }) => {
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { d as packageManagers, t as handler } from "./handler-C71cBXgA.js";
2
+ import { t as handler, u as packageManagers } from "./handler-BVAo8CHH.js";
3
3
  import { logger } from "@docusaurus/logger";
4
4
  import semver from "semver";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
7
7
  //#region package.json
8
- var version = "2.0.0-next.14";
8
+ var version = "2.0.0-next.15";
9
9
  //#endregion
10
10
  //#region cli.ts
11
- const requiredVersion = { "node": ">=22.20.0" }.node;
11
+ const requiredVersion = { "node": "^22.20.0 || ^24.0.0 || >=26.0.0" }.node;
12
12
  if (!semver.satisfies(process.version, requiredVersion)) {
13
13
  logger.error("Minimum Node.js version not met :(");
14
14
  logger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../package.json","../cli.ts"],"sourcesContent":["","#!/usr/bin/env node\n\nimport { logger } from '@docusaurus/logger';\nimport semver from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { packageManagers } from './lib/constants.ts';\nimport { handler } from './lib/handler.ts';\nimport { engines, version } from './package.json';\n\nconst requiredVersion = engines.node;\n\nif (!semver.satisfies(process.version, requiredVersion)) {\n\tlogger.error('Minimum Node.js version not met :(');\n\tlogger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;\n\tprocess.exit(1);\n}\n\nprocess.on('unhandledRejection', (err) => {\n\tlogger.error(err);\n\tprocess.exit(1);\n});\n\nawait yargs(hideBin(process.argv))\n\t.version(version)\n\t.command({\n\t\tcommand: '* [appName] [template] [rootDir]',\n\t\tdescribe: 'Initialize Baeta application',\n\t\tbuilder: (yargs) => {\n\t\t\treturn yargs\n\t\t\t\t.option('package-manager', {\n\t\t\t\t\talias: 'p',\n\t\t\t\t\tdescribe: 'The package manager used to install dependencies.',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tchoices: packageManagers,\n\t\t\t\t})\n\t\t\t\t.option('skip-install', {\n\t\t\t\t\talias: 's',\n\t\t\t\t\tdescribe: 'Do not run package manager immediately after scaffolding',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t})\n\t\t\t\t.positional('appName', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Name of the app',\n\t\t\t\t})\n\t\t\t\t.positional('template', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Template to use',\n\t\t\t\t\tchoices: ['yoga', 'apollo'],\n\t\t\t\t})\n\t\t\t\t.positional('rootDir', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Root directory',\n\t\t\t\t\tdefault: '.',\n\t\t\t\t});\n\t\t},\n\t\thandler: (argv) => handler(argv),\n\t})\n\t.showHelpOnFail(true)\n\t.strict()\n\t.help()\n\t.parse();\n"],"mappings":";;;;;;;;;;ACUA,MAAM,kBAAkB,uBAAA,CAAQ;AAEhC,IAAI,CAAC,OAAO,UAAU,QAAQ,SAAS,gBAAgB,EAAE;AACxD,QAAO,MAAM,qCAAqC;AAClD,QAAO,IAAI,gCAAgC,QAAQ,QAAQ,gCAAgC,gBAAgB;AAC3G,SAAQ,KAAK,EAAE;;AAGhB,QAAQ,GAAG,uBAAuB,QAAQ;AACzC,QAAO,MAAM,IAAI;AACjB,SAAQ,KAAK,EAAE;EACd;AAEF,MAAM,MAAM,QAAQ,QAAQ,KAAK,CAAC,CAChC,QAAQ,QAAQ,CAChB,QAAQ;CACR,SAAS;CACT,UAAU;CACV,UAAU,UAAU;AACnB,SAAO,MACL,OAAO,mBAAmB;GAC1B,OAAO;GACP,UAAU;GACV,MAAM;GACN,SAAS;GACT,CAAC,CACD,OAAO,gBAAgB;GACvB,OAAO;GACP,UAAU;GACV,MAAM;GACN,CAAC,CACD,WAAW,WAAW;GACtB,MAAM;GACN,UAAU;GACV,CAAC,CACD,WAAW,YAAY;GACvB,MAAM;GACN,UAAU;GACV,SAAS,CAAC,QAAQ,SAAS;GAC3B,CAAC,CACD,WAAW,WAAW;GACtB,MAAM;GACN,UAAU;GACV,SAAS;GACT,CAAC;;CAEJ,UAAU,SAAS,QAAQ,KAAK;CAChC,CAAC,CACD,eAAe,KAAK,CACpB,QAAQ,CACR,MAAM,CACN,OAAO"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../package.json","../cli.ts"],"sourcesContent":["","#!/usr/bin/env node\n\nimport { logger } from '@docusaurus/logger';\nimport semver from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { packageManagers } from './lib/constants.ts';\nimport { handler } from './lib/handler.ts';\nimport { engines, version } from './package.json';\n\nconst requiredVersion = engines.node;\n\nif (!semver.satisfies(process.version, requiredVersion)) {\n\tlogger.error('Minimum Node.js version not met :(');\n\tlogger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;\n\tprocess.exit(1);\n}\n\nprocess.on('unhandledRejection', (err) => {\n\tlogger.error(err);\n\tprocess.exit(1);\n});\n\nawait yargs(hideBin(process.argv))\n\t.version(version)\n\t.command({\n\t\tcommand: '* [appName] [template] [rootDir]',\n\t\tdescribe: 'Initialize Baeta application',\n\t\tbuilder: (yargs) => {\n\t\t\treturn yargs\n\t\t\t\t.option('package-manager', {\n\t\t\t\t\talias: 'p',\n\t\t\t\t\tdescribe: 'The package manager used to install dependencies.',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tchoices: packageManagers,\n\t\t\t\t})\n\t\t\t\t.option('skip-install', {\n\t\t\t\t\talias: 's',\n\t\t\t\t\tdescribe: 'Do not run package manager immediately after scaffolding',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t})\n\t\t\t\t.positional('appName', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Name of the app',\n\t\t\t\t})\n\t\t\t\t.positional('template', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Template to use',\n\t\t\t\t\tchoices: ['yoga', 'apollo'],\n\t\t\t\t})\n\t\t\t\t.positional('rootDir', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Root directory',\n\t\t\t\t\tdefault: '.',\n\t\t\t\t});\n\t\t},\n\t\thandler: (argv) => handler(argv),\n\t})\n\t.showHelpOnFail(true)\n\t.strict()\n\t.help()\n\t.parse();\n"],"mappings":";;;;;;;;;;ACUA,MAAM,kBAAkB,4CAAA,EAAQ;AAEhC,IAAI,CAAC,OAAO,UAAU,QAAQ,SAAS,eAAe,GAAG;CACxD,OAAO,MAAM,oCAAoC;CACjD,OAAO,IAAI,gCAAgC,QAAQ,QAAQ,gCAAgC,gBAAgB;CAC3G,QAAQ,KAAK,CAAC;AACf;AAEA,QAAQ,GAAG,uBAAuB,QAAQ;CACzC,OAAO,MAAM,GAAG;CAChB,QAAQ,KAAK,CAAC;AACf,CAAC;AAED,MAAM,MAAM,QAAQ,QAAQ,IAAI,CAAC,EAC/B,QAAQ,OAAO,EACf,QAAQ;CACR,SAAS;CACT,UAAU;CACV,UAAU,UAAU;EACnB,OAAO,MACL,OAAO,mBAAmB;GAC1B,OAAO;GACP,UAAU;GACV,MAAM;GACN,SAAS;EACV,CAAC,EACA,OAAO,gBAAgB;GACvB,OAAO;GACP,UAAU;GACV,MAAM;EACP,CAAC,EACA,WAAW,WAAW;GACtB,MAAM;GACN,UAAU;EACX,CAAC,EACA,WAAW,YAAY;GACvB,MAAM;GACN,UAAU;GACV,SAAS,CAAC,QAAQ,QAAQ;EAC3B,CAAC,EACA,WAAW,WAAW;GACtB,MAAM;GACN,UAAU;GACV,SAAS;EACV,CAAC;CACH;CACA,UAAU,SAAS,QAAQ,IAAI;AAChC,CAAC,EACA,eAAe,IAAI,EACnB,OAAO,EACP,KAAK,EACL,MAAM"}
@@ -1,31 +1,18 @@
1
- import { logger } from "@docusaurus/logger";
2
1
  import path from "node:path";
2
+ import logger$1, { logger } from "@docusaurus/logger";
3
+ import input from "@inquirer/input";
4
+ import fs from "fs-extra";
3
5
  import shell from "shelljs";
4
6
  import supportsColor from "supports-color";
5
- import fs from "fs-extra";
6
- import prompts from "prompts";
7
- //#region lib/constants.ts
8
- const defaultPackageManager = "npm";
9
- const lockfileNames = {
10
- npm: "package-lock.json",
11
- yarn: "yarn.lock",
12
- pnpm: "pnpm-lock.yaml",
13
- bun: "bun.lockb"
14
- };
15
- const packageManagers = Object.keys(lockfileNames);
16
- const runtimes = [
17
- "node",
18
- "deno",
19
- "bun"
20
- ];
21
- const defaultJavaScriptRuntime = "node";
22
- const templates = ["yoga", "apollo"];
23
- //#endregion
7
+ import select from "@inquirer/select";
24
8
  //#region lib/app-name.ts
9
+ const APP_NAME_RE = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
25
10
  async function getAppName(reqName, rootDir) {
11
+ const resolvedRoot = path.resolve(rootDir);
26
12
  async function validateAppName(appName) {
27
13
  if (!appName) return "An app name is required.";
28
- const dest = path.resolve(rootDir, appName);
14
+ if (!APP_NAME_RE.test(appName)) return "App name must contain only lowercase letters, digits, dashes, underscores, or dots, and may optionally include an npm scope.";
15
+ const dest = path.resolve(resolvedRoot, appName);
29
16
  if (await fs.pathExists(dest)) return logger.interpolate`Directory already exists at path=${dest}!`;
30
17
  return true;
31
18
  }
@@ -34,22 +21,42 @@ async function getAppName(reqName, rootDir) {
34
21
  if (typeof res === "string") throw new TypeError(res);
35
22
  return reqName;
36
23
  }
37
- return await prompts({
38
- type: "text",
39
- name: "appName",
40
- message: "What should we name this app?",
41
- initial: "baeta-app",
42
- validate: validateAppName
43
- }, { onCancel() {
44
- logger.error("An app name is required.");
45
- process.exit(1);
46
- } }).then((result) => result.appName);
24
+ try {
25
+ return await input({
26
+ message: "What should we name this app?",
27
+ default: "baeta-app",
28
+ validate: validateAppName
29
+ });
30
+ } catch (error) {
31
+ if (error instanceof Error && error.name === "ExitPromptError") {
32
+ logger.error("An app name is required.");
33
+ process.exit(1);
34
+ }
35
+ throw error;
36
+ }
47
37
  }
48
38
  //#endregion
39
+ //#region lib/constants.ts
40
+ const defaultPackageManager = "npm";
41
+ const lockfileNames = {
42
+ npm: ["package-lock.json"],
43
+ yarn: ["yarn.lock"],
44
+ pnpm: ["pnpm-lock.yaml"],
45
+ bun: ["bun.lock", "bun.lockb"]
46
+ };
47
+ const packageManagers = Object.keys(lockfileNames);
48
+ const runtimes = [
49
+ "node",
50
+ "deno",
51
+ "bun"
52
+ ];
53
+ const defaultJavaScriptRuntime = "node";
54
+ const templates = ["yoga", "apollo"];
55
+ //#endregion
49
56
  //#region lib/package-manager.ts
50
57
  async function findPackageManagerFromLockFile(rootDir) {
51
- for (const packageManager of packageManagers) {
52
- const lockFilePath = path.join(rootDir, lockfileNames[packageManager]);
58
+ for (const packageManager of packageManagers) for (const lockFileName of lockfileNames[packageManager]) {
59
+ const lockFilePath = path.join(rootDir, lockFileName);
53
60
  if (await fs.pathExists(lockFilePath)) return packageManager;
54
61
  }
55
62
  }
@@ -61,22 +68,25 @@ async function askForPackageManagerChoice() {
61
68
  const hasPnpm = shell.exec("pnpm --version", { silent: true }).code === 0;
62
69
  const hasBun = shell.exec("bun --version", { silent: true }).code === 0;
63
70
  if (!hasYarn && !hasPnpm && !hasBun) return "npm";
64
- return await prompts({
65
- type: "select",
66
- name: "packageManager",
67
- message: "Select a package manager...",
68
- choices: [
69
- "npm",
70
- hasYarn && "yarn",
71
- hasPnpm && "pnpm",
72
- hasBun && "bun"
73
- ].filter((p) => p !== false).map((p) => ({
74
- title: p,
75
- value: p
76
- }))
77
- }, { onCancel() {
78
- logger.info`Falling back to name=${"npm"}`;
79
- } }).then((result) => result.packageManager) ?? "npm";
71
+ const choices = [
72
+ "npm",
73
+ hasYarn && "yarn",
74
+ hasPnpm && "pnpm",
75
+ hasBun && "bun"
76
+ ].filter((p) => p !== false).map((p) => ({ value: p }));
77
+ try {
78
+ return await select({
79
+ message: "Select a package manager...",
80
+ choices,
81
+ default: "npm"
82
+ });
83
+ } catch (error) {
84
+ if (error instanceof Error && error.name === "ExitPromptError") {
85
+ logger$1.info`Falling back to name=${"npm"}`;
86
+ return "npm";
87
+ }
88
+ throw error;
89
+ }
80
90
  }
81
91
  async function getPackageManager(dest, { packageManager, skipInstall }) {
82
92
  if (packageManager && !packageManagers.includes(packageManager)) throw new Error(`Invalid package manager choice ${packageManager}. Must be one of ${packageManagers.join(", ")}`);
@@ -101,21 +111,23 @@ async function getRuntime() {
101
111
  const hasBun = shell.exec("bun --version", { silent: true }).code === 0;
102
112
  const hasDeno = shell.exec("deno --version", { silent: true }).code === 0;
103
113
  if (!hasDeno && !hasBun) return "node";
104
- return await prompts({
105
- type: "select",
106
- name: "runtime",
107
- message: "Select a runtime...",
108
- choices: [
109
- "node",
110
- hasBun && "bun",
111
- hasDeno && "deno"
112
- ].filter((p) => p !== false).map((p) => ({
113
- title: p,
114
- value: p
115
- }))
116
- }, { onCancel() {
117
- logger.info`Falling back to name=${"node"}`;
118
- } }).then((result) => result.runtime) ?? "node";
114
+ const choices = [
115
+ "node",
116
+ hasBun && "bun",
117
+ hasDeno && "deno"
118
+ ].filter((p) => p !== false).map((p) => ({ value: p }));
119
+ try {
120
+ return await select({
121
+ message: "Select a runtime...",
122
+ choices
123
+ });
124
+ } catch (error) {
125
+ if (error instanceof Error && error.name === "ExitPromptError") {
126
+ logger.info`Falling back to name=${defaultJavaScriptRuntime}`;
127
+ return defaultJavaScriptRuntime;
128
+ }
129
+ throw error;
130
+ }
119
131
  }
120
132
  //#endregion
121
133
  //#region meta/apollo/package.json
@@ -129,16 +141,16 @@ var package_default$1 = {
129
141
  "start": "baeta generate --watch --run='node --watch --enable-source-maps --inspect src/app.ts'"
130
142
  },
131
143
  dependencies: {
132
- "@apollo/server": "^5.5.0",
144
+ "@apollo/server": "^5.5.1",
145
+ "@baeta/complexity": "workspace:^",
133
146
  "@baeta/core": "workspace:^",
134
147
  "@baeta/errors": "workspace:^",
135
- "@baeta/extension-complexity": "workspace:^",
136
148
  "graphql": "catalog:dev"
137
149
  },
138
150
  devDependencies: {
139
151
  "@baeta/cli": "workspace:^",
140
- "@types/bun": "^1.3.13",
141
- "@types/deno": "^2.5.0",
152
+ "@types/bun": "^1.3.14",
153
+ "@types/deno": "^2.7.0",
142
154
  "@types/node": "catalog:dev",
143
155
  "typescript": "catalog:dev"
144
156
  }
@@ -147,13 +159,13 @@ var package_default$1 = {
147
159
  //#region versions.apollo.json
148
160
  var versions_apollo_default = {
149
161
  dependencies: {
150
- "@baeta/core": "^2.0.0-next.14",
151
- "@baeta/errors": "^2.0.0-next.14",
152
- "@baeta/extension-complexity": "^2.0.0-next.14",
162
+ "@baeta/complexity": "^2.0.0-next.15",
163
+ "@baeta/core": "^2.0.0-next.15",
164
+ "@baeta/errors": "^2.0.0-next.15",
153
165
  "graphql": "^16.6.0"
154
166
  },
155
167
  devDependencies: {
156
- "@baeta/cli": "^2.0.0-next.14",
168
+ "@baeta/cli": "^2.0.0-next.15",
157
169
  "@types/node": "^22.19.17",
158
170
  "typescript": "^6.0.0"
159
171
  },
@@ -165,6 +177,7 @@ var compilerOptions = {
165
177
  "target": "es2024",
166
178
  "lib": ["es2024"],
167
179
  "noEmit": true,
180
+ "emitDeclarationOnly": false,
168
181
  "types": [],
169
182
  "module": "esnext",
170
183
  "moduleResolution": "bundler",
@@ -175,7 +188,12 @@ var compilerOptions = {
175
188
  "verbatimModuleSyntax": true,
176
189
  "allowImportingTsExtensions": true,
177
190
  "skipLibCheck": true,
178
- "forceConsistentCasingInFileNames": true
191
+ "forceConsistentCasingInFileNames": true,
192
+ "noErrorTruncation": true,
193
+ "noImplicitOverride": true,
194
+ "noFallthroughCasesInSwitch": true,
195
+ "noUncheckedSideEffectImports": true,
196
+ "noUnusedLocals": true
179
197
  };
180
198
  var tsconfig_default = {
181
199
  $schema: "https://json.schemastore.org/tsconfig",
@@ -200,29 +218,6 @@ function makeSharedTemplate(appName, runtime, packageJson, versions) {
200
218
  exclude: ["baeta.ts"]
201
219
  }, null, 2)
202
220
  },
203
- {
204
- relativePath: "./src/modules/extensions.ts",
205
- content: `import { createExtensions } from '@baeta/core';
206
- import { complexityExtension } from '@baeta/extension-complexity';
207
- import type { Context } from '../types/context.ts';
208
-
209
- const complexity = complexityExtension<Context>({
210
- defaultComplexity: 1,
211
- defaultListMultiplier: 10,
212
- async limit(ctx) {
213
- return {
214
- depth: 10,
215
- breadth: 50,
216
- complexity: 1000,
217
- };
218
- },
219
- });
220
-
221
- export default createExtensions({
222
- complexityExtension: complexity
223
- });
224
- `
225
- },
226
221
  {
227
222
  relativePath: "./src/modules/user/user.gql",
228
223
  content: `type User {
@@ -576,16 +571,16 @@ var package_default = {
576
571
  "start": "baeta generate --watch --run='node --watch --enable-source-maps --inspect src/app.ts'"
577
572
  },
578
573
  dependencies: {
574
+ "@baeta/complexity": "workspace:^",
579
575
  "@baeta/core": "workspace:^",
580
576
  "@baeta/errors": "workspace:^",
581
- "@baeta/extension-complexity": "workspace:^",
582
577
  "graphql": "catalog:dev",
583
578
  "graphql-yoga": "catalog:dev"
584
579
  },
585
580
  devDependencies: {
586
581
  "@baeta/cli": "workspace:^",
587
- "@types/bun": "^1.3.13",
588
- "@types/deno": "^2.5.0",
582
+ "@types/bun": "^1.3.14",
583
+ "@types/deno": "^2.7.0",
589
584
  "@types/node": "catalog:dev",
590
585
  "typescript": "catalog:dev"
591
586
  }
@@ -594,14 +589,14 @@ var package_default = {
594
589
  //#region versions.yoga.json
595
590
  var versions_yoga_default = {
596
591
  dependencies: {
597
- "@baeta/core": "^2.0.0-next.14",
598
- "@baeta/errors": "^2.0.0-next.14",
599
- "@baeta/extension-complexity": "^2.0.0-next.14",
592
+ "@baeta/complexity": "^2.0.0-next.15",
593
+ "@baeta/core": "^2.0.0-next.15",
594
+ "@baeta/errors": "^2.0.0-next.15",
600
595
  "graphql": "^16.6.0",
601
596
  "graphql-yoga": "^5.21.0"
602
597
  },
603
598
  devDependencies: {
604
- "@baeta/cli": "^2.0.0-next.14",
599
+ "@baeta/cli": "^2.0.0-next.15",
605
600
  "@types/node": "^22.19.17",
606
601
  "typescript": "^6.0.0"
607
602
  },
@@ -723,22 +718,23 @@ server.listen(4000, () => {
723
718
  //#region lib/templates.ts
724
719
  function createTemplateChoices() {
725
720
  return templates.map((template) => ({
726
- title: template,
721
+ name: template,
727
722
  value: template
728
723
  }));
729
724
  }
730
725
  async function askTemplateChoice() {
731
- return await prompts({
732
- type: "select",
733
- name: "template",
734
- message: "Select a template below...",
735
- choices: createTemplateChoices()
736
- }, { onCancel() {
737
- logger.error("A choice is required.");
738
- process.exit(1);
739
- } }).then((result) => {
740
- return result.template;
741
- });
726
+ try {
727
+ return await select({
728
+ message: "Select a template below...",
729
+ choices: createTemplateChoices()
730
+ });
731
+ } catch (error) {
732
+ if (error instanceof Error && error.name === "ExitPromptError") {
733
+ logger.error("A choice is required.");
734
+ process.exit(1);
735
+ }
736
+ throw error;
737
+ }
742
738
  }
743
739
  async function getTemplate(reqTemplate) {
744
740
  const template = (reqTemplate ? templates.find((t) => t === reqTemplate) : null) ?? await askTemplateChoice();
@@ -753,9 +749,10 @@ function getTemplateFiles(template, appName, runtime) {
753
749
  }
754
750
  }
755
751
  async function copyTemplate(appName, runtime, template, dest) {
756
- const promises = (await getTemplateFiles(template, appName, runtime)).map((file) => {
752
+ const promises = (await getTemplateFiles(template, appName, runtime)).map(async (file) => {
757
753
  const filePath = path.join(dest, file.relativePath);
758
- return fs.ensureDir(path.dirname(filePath)).then(() => fs.writeFile(filePath, file.content));
754
+ await fs.ensureDir(path.dirname(filePath));
755
+ await fs.writeFile(filePath, file.content);
759
756
  });
760
757
  await Promise.all(promises);
761
758
  }
@@ -780,19 +777,21 @@ async function handler(args) {
780
777
  const cd = `cd ${dest}`;
781
778
  const install = `${pkgManager} install`;
782
779
  if (!args.skipInstall) {
783
- shell.cd(dest);
784
780
  logger.info`Installing dependencies with name=${pkgManager}...`;
785
- if (shell.exec(getInstallCommand(pkgManager), { env: {
786
- ...process.env,
787
- ...supportsColor.stdout ? { FORCE_COLOR: "1" } : {}
788
- } }).code !== 0) {
781
+ if (shell.exec(getInstallCommand(pkgManager), {
782
+ cwd: dest,
783
+ env: {
784
+ ...process.env,
785
+ ...supportsColor.stdout ? { FORCE_COLOR: "1" } : {}
786
+ }
787
+ }).code !== 0) {
789
788
  console.error("Dependency installation failed.");
790
789
  logger.error("Dependency installation failed.");
791
790
  logger.info`The app directory has already been created, and you can retry by typing:
792
791
 
793
792
  code=${cd}
794
793
  code=${install}`;
795
- process.exit(0);
794
+ process.exit(1);
796
795
  }
797
796
  }
798
797
  logger.success`Created name=${dest}.`;
@@ -811,6 +810,6 @@ We recommend that you begin by typing:
811
810
  `;
812
811
  }
813
812
  //#endregion
814
- export { getInstallCommand as a, defaultJavaScriptRuntime as c, packageManagers as d, runtimes as f, getRuntime as i, defaultPackageManager as l, copyTemplate as n, getPackageManager as o, templates as p, getTemplate as r, getAppName as s, handler as t, lockfileNames as u };
813
+ export { getInstallCommand as a, defaultPackageManager as c, runtimes as d, templates as f, getRuntime as i, lockfileNames as l, copyTemplate as n, getPackageManager as o, getAppName as p, getTemplate as r, defaultJavaScriptRuntime as s, handler as t, packageManagers as u };
815
814
 
816
- //# sourceMappingURL=handler-C71cBXgA.js.map
815
+ //# sourceMappingURL=handler-BVAo8CHH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler-BVAo8CHH.js","names":["tsconfig","tsconfig.compilerOptions","apolloPackageJson","versions","yogaPackageJson","versions"],"sources":["../lib/app-name.ts","../lib/constants.ts","../lib/package-manager.ts","../lib/runtime.ts","../meta/apollo/package.json","../versions.apollo.json","../../../tools/tsconfig/tsconfig.json","../templates/shared.ts","../templates/apollo.ts","../meta/yoga/package.json","../versions.yoga.json","../templates/yoga.ts","../lib/templates.ts","../lib/handler.ts"],"sourcesContent":["import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport input from '@inquirer/input';\nimport fs from 'fs-extra';\n\nconst APP_NAME_RE = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/;\n\nexport async function getAppName(reqName: string | undefined, rootDir: string): Promise<string> {\n\tconst resolvedRoot = path.resolve(rootDir);\n\n\tasync function validateAppName(appName: string) {\n\t\tif (!appName) {\n\t\t\treturn 'An app name is required.';\n\t\t}\n\t\tif (!APP_NAME_RE.test(appName)) {\n\t\t\treturn 'App name must contain only lowercase letters, digits, dashes, underscores, or dots, and may optionally include an npm scope.';\n\t\t}\n\t\tconst dest = path.resolve(resolvedRoot, appName);\n\t\tif (await fs.pathExists(dest)) {\n\t\t\treturn logger.interpolate`Directory already exists at path=${dest}!`;\n\t\t}\n\t\treturn true;\n\t}\n\n\tif (reqName) {\n\t\tconst res = await validateAppName(reqName);\n\t\tif (typeof res === 'string') {\n\t\t\tthrow new TypeError(res);\n\t\t}\n\t\treturn reqName;\n\t}\n\n\ttry {\n\t\treturn await input({\n\t\t\tmessage: 'What should we name this app?',\n\t\t\tdefault: 'baeta-app',\n\t\t\tvalidate: validateAppName,\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.name === 'ExitPromptError') {\n\t\t\tlogger.error('An app name is required.');\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tthrow error;\n\t}\n}\n","export const defaultPackageManager = 'npm';\n\nexport const lockfileNames = {\n\tnpm: ['package-lock.json'],\n\tyarn: ['yarn.lock'],\n\tpnpm: ['pnpm-lock.yaml'],\n\tbun: ['bun.lock', 'bun.lockb'],\n} as const;\n\nexport const packageManagers = Object.keys(lockfileNames) as PackageManager[];\n\nexport type PackageManager = keyof typeof lockfileNames;\n\nexport const runtimes = ['node', 'deno', 'bun'] as const;\n\nexport type JavaScriptRuntime = (typeof runtimes)[number];\n\nexport const defaultJavaScriptRuntime = 'node';\n\nexport const templates = ['yoga', 'apollo'] as const;\nexport type Template = (typeof templates)[number];\n","import path from 'node:path';\nimport logger from '@docusaurus/logger';\nimport select from '@inquirer/select';\nimport fs from 'fs-extra';\nimport shell from 'shelljs';\nimport type { CliOptions } from './cli-options.ts';\nimport {\n\tdefaultPackageManager,\n\tlockfileNames,\n\ttype PackageManager,\n\tpackageManagers,\n} from './constants.ts';\n\nasync function findPackageManagerFromLockFile(\n\trootDir: string,\n): Promise<PackageManager | undefined> {\n\tfor (const packageManager of packageManagers) {\n\t\tfor (const lockFileName of lockfileNames[packageManager]) {\n\t\t\tconst lockFilePath = path.join(rootDir, lockFileName);\n\t\t\tif (await fs.pathExists(lockFilePath)) {\n\t\t\t\treturn packageManager;\n\t\t\t}\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction findPackageManagerFromUserAgent(): PackageManager | undefined {\n\treturn packageManagers.find((packageManager) =>\n\t\tprocess.env.npm_config_user_agent?.startsWith(packageManager),\n\t);\n}\n\nasync function askForPackageManagerChoice(): Promise<PackageManager> {\n\tconst hasYarn = shell.exec('yarn --version', { silent: true }).code === 0;\n\tconst hasPnpm = shell.exec('pnpm --version', { silent: true }).code === 0;\n\tconst hasBun = shell.exec('bun --version', { silent: true }).code === 0;\n\n\tif (!hasYarn && !hasPnpm && !hasBun) {\n\t\treturn 'npm';\n\t}\n\tconst choices = [\n\t\t'npm' as const,\n\t\thasYarn && ('yarn' as const),\n\t\thasPnpm && ('pnpm' as const),\n\t\thasBun && ('bun' as const),\n\t]\n\t\t.filter((p) => p !== false)\n\t\t.map((p) => ({ value: p }));\n\n\ttry {\n\t\treturn await select<PackageManager>({\n\t\t\tmessage: 'Select a package manager...',\n\t\t\tchoices,\n\t\t\tdefault: defaultPackageManager,\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.name === 'ExitPromptError') {\n\t\t\tlogger.info`Falling back to name=${defaultPackageManager}`;\n\t\t\treturn defaultPackageManager;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nexport async function getPackageManager(\n\tdest: string,\n\t{ packageManager, skipInstall }: CliOptions,\n): Promise<PackageManager> {\n\tif (packageManager && !packageManagers.includes(packageManager)) {\n\t\tthrow new Error(\n\t\t\t`Invalid package manager choice ${packageManager}. Must be one of ${packageManagers.join(\n\t\t\t\t', ',\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tconst fromLockfile = await findPackageManagerFromLockFile(dest);\n\n\tif (fromLockfile) {\n\t\treturn fromLockfile;\n\t}\n\n\tif (packageManager) {\n\t\treturn packageManager;\n\t}\n\n\tconst fromLockfileInCwd = await findPackageManagerFromLockFile('.');\n\n\tif (fromLockfileInCwd) {\n\t\treturn fromLockfileInCwd;\n\t}\n\n\tconst fromUserAgent = findPackageManagerFromUserAgent();\n\n\tif (fromUserAgent) {\n\t\treturn fromUserAgent;\n\t}\n\n\tif (skipInstall) {\n\t\treturn defaultPackageManager;\n\t}\n\n\treturn await askForPackageManagerChoice();\n}\n\nexport function getInstallCommand(pkgManager: PackageManager): string {\n\tif (pkgManager === 'yarn') {\n\t\treturn 'yarn';\n\t}\n\tif (pkgManager === 'bun') {\n\t\treturn 'bun install';\n\t}\n\treturn `${pkgManager} install --color always`;\n}\n","import { logger } from '@docusaurus/logger';\nimport select from '@inquirer/select';\nimport shell from 'shelljs';\nimport { defaultJavaScriptRuntime, type JavaScriptRuntime } from './constants.ts';\n\nexport async function getRuntime(): Promise<JavaScriptRuntime> {\n\tconst hasBun = shell.exec('bun --version', { silent: true }).code === 0;\n\tconst hasDeno = shell.exec('deno --version', { silent: true }).code === 0;\n\n\tif (!hasDeno && !hasBun) {\n\t\treturn 'node';\n\t}\n\tconst choices = ['node' as const, hasBun && ('bun' as const), hasDeno && ('deno' as const)]\n\t\t.filter((p) => p !== false)\n\t\t.map((p) => ({ value: p }));\n\n\ttry {\n\t\treturn await select<JavaScriptRuntime>({\n\t\t\tmessage: 'Select a runtime...',\n\t\t\tchoices,\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.name === 'ExitPromptError') {\n\t\t\tlogger.info`Falling back to name=${defaultJavaScriptRuntime}`;\n\t\t\treturn defaultJavaScriptRuntime;\n\t\t}\n\t\tthrow error;\n\t}\n}\n","","","","import tsconfig from '../../../tools/tsconfig/tsconfig.json';\nimport type { JavaScriptRuntime } from '../lib/constants.ts';\nimport type { TemplateFile } from '../lib/template-file.ts';\n\nexport type PackageJson = {\n\tname: string;\n\tscripts: Record<string, string | undefined>;\n\tdependencies: Record<string, string | undefined>;\n\tdevDependencies: Record<string, string | undefined>;\n};\n\nexport type ResolvedPackageVersions = {\n\tdependencies: Record<string, string | undefined>;\n\tdevDependencies: Record<string, string | undefined>;\n\tpeerDependencies: Record<string, string | undefined>;\n};\n\nexport function makeSharedTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n\tpackageJson: PackageJson,\n\tversions: ResolvedPackageVersions,\n): TemplateFile[] {\n\treturn [\n\t\tmakePackageJson(appName, runtime, packageJson, versions),\n\t\t{\n\t\t\trelativePath: './tsconfig.json',\n\t\t\tcontent: JSON.stringify(\n\t\t\t\t{\n\t\t\t\t\t...tsconfig,\n\t\t\t\t\tcompilerOptions: {\n\t\t\t\t\t\t...tsconfig.compilerOptions,\n\t\t\t\t\t\trootDir: 'src',\n\t\t\t\t\t\toutDir: 'dist',\n\t\t\t\t\t\tnoEmit: true,\n\t\t\t\t\t\temitDeclarationOnly: false,\n\t\t\t\t\t},\n\t\t\t\t\texclude: ['baeta.ts'],\n\t\t\t\t},\n\t\t\t\tnull,\n\t\t\t\t2,\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user/user.gql',\n\t\t\tcontent: `type User {\n\tid: ID!\n\temail: String!\n\tlastName: String!\n\tprofile: String\n\tgivenName: String\n}\n\ninput UserWhereUniqueInput {\n\tid: ID!\n}\n\ntype Query {\n\tuser(where: UserWhereUniqueInput!): User\n\tusers: [User!]\n}\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user/index.ts',\n\t\t\tcontent: `import { UserModule } from './typedef.ts';\n\nconst { Query, User } = UserModule;\n\nconst userQuery = Query.user\n\t.$use(async (next, { args }) => {\n\t\tconst result = await next();\n\t\tconsole.log('Got user:', result, 'for args:', args);\n\t\treturn result;\n\t})\n\t.resolve(({ args }) => {\n\t\treturn {\n\t\t\tid: args.where.id,\n\t\t\temail: 'jon.doe@baeta.io',\n\t\t\tlastName: 'Doe',\n\t\t\tgivenName: null,\n\t\t\tprofile: null,\n\t\t};\n\t});\n\nconst usersQuery = Query.users.resolve(() => {\n\tconst users = Array.from({ length: 10 }).map((_, i) => ({\n\t\tid: i.toString(),\n\t\temail: \\`jon.doe\\${i}@baeta.io\\`,\n\t\tlastName: \\`Doe \\${i}\\`,\n\t\tgivenName: null,\n\t\tprofile: null,\n\t}));\n\treturn users;\n});\n\nexport default UserModule.$schema({\n\tUser: User.$fields({\n\t\tid: User.id.key('id'),\n\t\temail: User.email.key('email'),\n\t\tlastName: User.lastName.key('lastName'),\n\t\tgivenName: User.givenName.key('givenName').undefinedAsNull(),\n\t\tprofile: User.profile.key('profile').undefinedAsNull(),\n\t}),\n\tQuery: Query.$fields({\n\t\tuser: userQuery,\n\t\tusers: usersQuery,\n\t}),\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user-photos/user-photos.gql',\n\t\t\tcontent: `type UserPhoto {\n\tid: ID!\n\tuserId: ID!\n\turl: String!\n}\n\nextend type User {\n\tphotos: [UserPhoto!]\n}\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user-photos/index.ts',\n\t\t\tcontent: `import { UserPhotosModule } from './typedef.ts';\n\nconst { User, UserPhoto } = UserPhotosModule;\n\nexport default UserPhotosModule.$schema({\n\tUser: User.$fields({\n\t\tphotos: User.photos.resolve(({ source }) => {\n\t\t\treturn Array.from({ length: 10 }).map((_, i) => ({\n\t\t\t\tid: \\`u\\${source.id}_p\\${i}\\`,\n\t\t\t\tuserId: source.id,\n\t\t\t\turl: \\`https://baeta.io/user/\\${source.id}/photo/\\${i}.png\\`,\n\t\t\t}));\n\t\t}),\n\t}),\n\tUserPhoto: UserPhoto.$fields({\n\t\tid: UserPhoto.id.key('id'),\n\t\turl: UserPhoto.url.key('url'),\n\t\tuserId: UserPhoto.userId.key('userId'),\n\t}),\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/types.ts',\n\t\t\tcontent: `import type { GraphQLResolveInfo } from 'graphql';\nimport type { BaseObjectTypes, BaseScalars } from '../__generated__/utility.ts';\nimport type { Context } from '../types/context.ts';\n\nexport interface Scalars extends BaseScalars {}\n\nexport interface ObjectTypes extends BaseObjectTypes {\n\tUser: {\n\t\tid: string;\n\t\temail: string;\n\t\tlastName: string;\n\t\tgivenName?: string | null;\n\t\tprofile?: string | null;\n\t};\n}\n\nexport type Ctx = Context;\n\nexport type Info = GraphQLResolveInfo;\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './baeta.ts',\n\t\t\tcontent: `import { defineConfig } from '@baeta/cli';\n\nexport default defineConfig({\n\tgraphql: {\n\t\tschemas: ['src/**/*.gql'],\n\t},\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './.gitignore',\n\t\t\tcontent: `# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# Snowpack dependency directory (https://snowpack.dev/)\nweb_modules/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional stylelint cache\n.stylelintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variable files\n.env\n.env.development.local\n.env.test.local\n.env.production.local\n.env.local\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n.parcel-cache\n\n# Next.js build output\n.next\nout\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n# Comment in the public line in if your project uses Gatsby and not Next.js\n# https://nextjs.org/blog/next-9-1#public-directory-support\n# public\n\n# vuepress build output\n.vuepress/dist\n\n# vuepress v2.x temp and cache directory\n.temp\n.cache\n\n# vitepress build output\n**/.vitepress/dist\n\n# vitepress cache directory\n**/.vitepress/cache\n\n# Docusaurus cache and generated files\n.docusaurus\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n\n# Stores VSCode versions used for testing VSCode extensions\n.vscode-test\n\n# yarn v2\n.yarn/cache\n.yarn/unplugged\n.yarn/build-state.yml\n.yarn/install-state.gz\n.pnp.*\n`,\n\t\t},\n\t];\n}\n\nfunction makePackageJson(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n\tpackageJson: {\n\t\tname: string;\n\t\tscripts: Record<string, string | undefined>;\n\t\tdependencies: Record<string, string | undefined>;\n\t\tdevDependencies: Record<string, string | undefined>;\n\t},\n\tversions: ResolvedPackageVersions,\n) {\n\tconst meta = structuredClone(packageJson);\n\tconst fields = ['dependencies', 'devDependencies'] as const;\n\tfor (const field of fields) {\n\t\tfor (const [dep, version] of Object.entries(versions[field] ?? {})) {\n\t\t\tmeta[field][dep] = version;\n\t\t}\n\t}\n\n\tif (runtime === 'node') {\n\t\tmeta.devDependencies['@types/bun'] = undefined;\n\t\tmeta.devDependencies['@types/deno'] = undefined;\n\t}\n\n\tif (runtime === 'bun') {\n\t\tmeta.scripts.start = `baeta generate --watch --run='bun --watch --inspect src/app.ts'`;\n\t\tmeta.devDependencies['@types/node'] = undefined;\n\t\tmeta.devDependencies['@types/deno'] = undefined;\n\t}\n\n\tif (runtime === 'deno') {\n\t\tmeta.scripts.start = `baeta generate --watch --run='deno --watch --allow-env --allow-read --allow-net src/app.ts'`;\n\t\tmeta.devDependencies['@types/node'] = undefined;\n\t\tmeta.devDependencies['@types/bun'] = undefined;\n\t}\n\n\tmeta.name = appName;\n\n\treturn {\n\t\trelativePath: './package.json',\n\t\tcontent: JSON.stringify(meta, null, 2),\n\t};\n}\n","import type { JavaScriptRuntime } from '../lib/constants.ts';\nimport type { TemplateFile } from '../lib/template-file.ts';\nimport apolloPackageJson from '../meta/apollo/package.json';\nimport versions from '../versions.apollo.json';\nimport { makeSharedTemplate } from './shared.ts';\n\nexport async function makeApolloTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n): Promise<TemplateFile[]> {\n\treturn [\n\t\t...makeSharedTemplate(appName, runtime, apolloPackageJson, versions),\n\t\t{\n\t\t\trelativePath: './src/types/context.ts',\n\t\t\tcontent: `export type Context = {\n\tuserId?: string;\n};\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { ApolloServer } from '@apollo/server';\nimport { startStandaloneServer } from '@apollo/server/standalone';\nimport { createApplication } from '@baeta/core';\nimport modules from './modules/index.ts';\nimport type { Context } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nconst server = new ApolloServer<Context>({\n\tschema: baeta.schema,\n});\n\nconst { url } = await startStandaloneServer(server, {\n\tlisten: { port: 4000 },\n});\n\nconsole.log(\\`🚀 Server ready at: \\${url}\\`);\n`,\n\t\t},\n\t];\n}\n","","","import type { JavaScriptRuntime } from '../lib/constants.ts';\nimport type { TemplateFile } from '../lib/template-file.ts';\nimport yogaPackageJson from '../meta/yoga/package.json';\nimport versions from '../versions.yoga.json';\nimport { makeSharedTemplate } from './shared.ts';\n\nexport async function makeYogaTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n): Promise<TemplateFile[]> {\n\treturn [\n\t\t...makeSharedTemplate(appName, runtime, yogaPackageJson, versions),\n\t\t...makeRuntimeFiles(runtime),\n\t\t{\n\t\t\trelativePath: './src/types/context.ts',\n\t\t\tcontent: `export type Context = {\n\tappVersion: string;\n};\n\nexport type ServerContext = {};\n`,\n\t\t},\n\t];\n}\n\nfunction makeRuntimeFiles(runtime: JavaScriptRuntime): TemplateFile[] {\n\tswitch (runtime) {\n\t\tcase 'bun':\n\t\t\treturn makeBunFiles();\n\t\tcase 'deno':\n\t\t\treturn makeDenoFiles();\n\t\tcase 'node':\n\t\t\treturn makeNodeFiles();\n\t\tdefault:\n\t\t\treturn [] satisfies never[];\n\t}\n}\n\nfunction makeBunFiles(): TemplateFile[] {\n\treturn [\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { createApplication } from '@baeta/core';\nimport { createYoga } from 'graphql-yoga';\nimport modules from './modules/index.ts';\nimport type { Context, ServerContext } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nexport const yoga = createYoga<ServerContext, Context>({\n\tschema: baeta.schema,\n\tcontext: {\n\t\tappVersion: '1.0.0',\n\t},\n});\n\nBun.serve({\n\tfetch: yoga.fetch,\n\tport: 4000,\n});\n\nconsole.log(\\`🚀 Server ready at http://localhost:4000\\${yoga.graphqlEndpoint}\\`);\n`,\n\t\t},\n\t];\n}\n\nfunction makeDenoFiles(): TemplateFile[] {\n\treturn [\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { createApplication } from '@baeta/core';\nimport { createYoga } from 'graphql-yoga';\nimport modules from './modules/index.ts';\nimport type { Context, ServerContext } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nexport const yoga = createYoga<ServerContext, Context>({\n\tschema: baeta.schema,\n\tcontext: {\n\t\tappVersion: '1.0.0',\n\t},\n});\n\nDeno.serve(\n\t{\n\t\tport: 4000,\n\t\tonListen() {\n\t\t\tconsole.log(\\`🚀 Server ready at http://localhost:4000\\${yoga.graphqlEndpoint}\\`);\n\t\t},\n\t},\n\tyoga.fetch,\n);\n`,\n\t\t},\n\t];\n}\n\nfunction makeNodeFiles(): TemplateFile[] {\n\treturn [\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { createServer } from 'node:http';\nimport { createApplication } from '@baeta/core';\nimport { createYoga } from 'graphql-yoga';\nimport modules from './modules/index.ts';\nimport type { Context, ServerContext } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nexport const yoga = createYoga<ServerContext, Context>({\n\tschema: baeta.schema,\n\tcontext: {\n\t\tappVersion: '1.0.0',\n\t},\n});\n\nconst server = createServer(yoga);\n\nserver.listen(4000, () => {\n\tconsole.log(\\`🚀 Server ready at http://localhost:4000\\${yoga.graphqlEndpoint}\\`);\n});\n`,\n\t\t},\n\t];\n}\n","import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport select from '@inquirer/select';\nimport fs from 'fs-extra';\nimport { makeApolloTemplate } from '../templates/apollo.ts';\nimport { makeYogaTemplate } from '../templates/yoga.ts';\nimport { type JavaScriptRuntime, type Template, templates } from './constants.ts';\n\nfunction createTemplateChoices() {\n\treturn templates.map((template) => ({ name: template, value: template }));\n}\n\nasync function askTemplateChoice() {\n\ttry {\n\t\treturn await select<Template>({\n\t\t\tmessage: 'Select a template below...',\n\t\t\tchoices: createTemplateChoices(),\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error && error.name === 'ExitPromptError') {\n\t\t\tlogger.error('A choice is required.');\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nexport async function getTemplate(reqTemplate: string | undefined) {\n\tconst userProvided = reqTemplate ? templates.find((t) => t === reqTemplate) : null;\n\tconst template = userProvided ?? (await askTemplateChoice());\n\n\tif (!template) {\n\t\tthrow new Error('Template not found');\n\t}\n\n\treturn template;\n}\n\nfunction getTemplateFiles(template: Template, appName: string, runtime: JavaScriptRuntime) {\n\tswitch (template) {\n\t\tcase 'yoga':\n\t\t\treturn makeYogaTemplate(appName, runtime);\n\t\tcase 'apollo':\n\t\t\treturn makeApolloTemplate(appName, runtime);\n\t\tdefault:\n\t\t\treturn [] satisfies never[];\n\t}\n}\n\nexport async function copyTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n\ttemplate: Template,\n\tdest: string,\n) {\n\tconst files = await getTemplateFiles(template, appName, runtime);\n\tconst promises = files.map(async (file) => {\n\t\tconst filePath = path.join(dest, file.relativePath);\n\t\tawait fs.ensureDir(path.dirname(filePath));\n\t\tawait fs.writeFile(filePath, file.content);\n\t});\n\tawait Promise.all(promises);\n}\n","import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport shell from 'shelljs';\nimport supportsColor from 'supports-color';\nimport { getAppName } from './app-name.ts';\nimport type { PackageManager } from './constants.ts';\nimport { getInstallCommand, getPackageManager } from './package-manager.ts';\nimport { getRuntime } from './runtime.ts';\nimport { copyTemplate, getTemplate } from './templates.ts';\n\nexport interface Args {\n\tpackageManager?: PackageManager;\n\tskipInstall?: boolean;\n\tappName?: string;\n\ttemplate?: string;\n\trootDir: string;\n}\n\nexport async function handler(args: Args) {\n\tconst appName = await getAppName(args.appName, args.rootDir);\n\tconst dest = path.resolve(args.rootDir, appName);\n\n\tconst template = await getTemplate(args.template);\n\n\tconst runtime = await getRuntime();\n\n\tlogger.info('Creating new Baeta project...');\n\n\ttry {\n\t\tawait copyTemplate(appName, runtime, template, dest);\n\t} catch (err) {\n\t\tlogger.error`Copying Baeta template name=${template} failed!`;\n\t\tthrow err;\n\t}\n\n\tconst pkgManager = await getPackageManager(dest, args);\n\n\tconst useNpm = pkgManager === 'npm';\n\tconst useBun = pkgManager === 'bun';\n\tconst useRunCommand = useNpm || useBun;\n\tconst runCommand = useRunCommand ? 'run ' : '';\n\n\tconst start = `${pkgManager} start`;\n\tconst build = `${pkgManager} ${runCommand}build`;\n\tconst cd = `cd ${dest}`;\n\tconst install = `${pkgManager} install`;\n\n\tif (!args.skipInstall) {\n\t\tlogger.info`Installing dependencies with name=${pkgManager}...`;\n\t\tconst result = shell.exec(getInstallCommand(pkgManager), {\n\t\t\tcwd: dest,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t...(supportsColor.stdout ? { FORCE_COLOR: '1' } : {}),\n\t\t\t},\n\t\t});\n\n\t\tif (result.code !== 0) {\n\t\t\tconsole.error('Dependency installation failed.');\n\t\t\tlogger.error('Dependency installation failed.');\n\t\t\tlogger.info`The app directory has already been created, and you can retry by typing:\n\ncode=${cd}\ncode=${install}`;\n\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tlogger.success`Created name=${dest}.`;\n\n\tlogger.info`Inside that directory, you can run several commands:\n\n code=${start}\n Starts the development server.\n\n code=${build}\n Generates the Baeta application.\n\nWe recommend that you begin by typing:\n\n code=${cd}\n code=${start}\n`;\n}\n"],"mappings":";;;;;;;;AAKA,MAAM,cAAc;AAEpB,eAAsB,WAAW,SAA6B,SAAkC;CAC/F,MAAM,eAAe,KAAK,QAAQ,OAAO;CAEzC,eAAe,gBAAgB,SAAiB;EAC/C,IAAI,CAAC,SACJ,OAAO;EAER,IAAI,CAAC,YAAY,KAAK,OAAO,GAC5B,OAAO;EAER,MAAM,OAAO,KAAK,QAAQ,cAAc,OAAO;EAC/C,IAAI,MAAM,GAAG,WAAW,IAAI,GAC3B,OAAO,OAAO,WAAW,oCAAoC,KAAK;EAEnE,OAAO;CACR;CAEA,IAAI,SAAS;EACZ,MAAM,MAAM,MAAM,gBAAgB,OAAO;EACzC,IAAI,OAAO,QAAQ,UAClB,MAAM,IAAI,UAAU,GAAG;EAExB,OAAO;CACR;CAEA,IAAI;EACH,OAAO,MAAM,MAAM;GAClB,SAAS;GACT,SAAS;GACT,UAAU;EACX,CAAC;CACF,SAAS,OAAO;EACf,IAAI,iBAAiB,SA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AAM,aAAa,SAAS,SAAS,UAAU,IAAI;CACpD,SAAS,KAAK;EACb,OAAO,KAAK,+BAA+B,SAAS;EACpD,MAAM;CACP;CAEA,MAAM,aAAa,MAAM,kBAAkB,MAAM,IAAI;CAKrD,MAAM,aAHS,eAAe,SACf,eAAe,QAEK,SAAS;CAE5C,MAAM,QAAQ,GAAG,WAAW;CAC5B,MAAM,QAAQ,GAAG,WAAW,GAAG,WAAW;CAC1C,MAAM,KAAK,MAAM;CACjB,MAAM,UAAU,GAAG,WAAW;CAE9B,IAAI,CAAC,KAAK,aAAa;EACtB,OAAO,IAAI,qCAAqC,WAAW;EAS3D,IARe,MAAM,KAAK,kBAAkB,UAAU,GAAG;GACxD,KAAK;GACL,KAAK;IACJ,GAAG,QAAQ;IACX,GAAI,cAAc,SAAS,EAAE,aAAa,IAAI,IAAI,CAAC;GACpD;EACD,CAES,EAAE,SAAS,GAAG;GACtB,QAAQ,MAAM,iCAAiC;GAC/C,OAAO,MAAM,iCAAiC;GAC9C,OAAO,IAAI;;OAEP,GAAG;OACH;GAEJ,QAAQ,KAAK,CAAC;EACf;CACD;CAEA,OAAO,OAAO,gBAAgB,KAAK;CAEnC,OAAO,IAAI;;SAEH,MAAM;;;SAGN,MAAM;;;;;SAKN,GAAG;SACH,MAAM;;AAEf"}
package/dist/index.d.ts CHANGED
@@ -4,10 +4,10 @@ declare function getAppName(reqName: string | undefined, rootDir: string): Promi
4
4
  //#region lib/constants.d.ts
5
5
  declare const defaultPackageManager = "npm";
6
6
  declare const lockfileNames: {
7
- npm: string;
8
- yarn: string;
9
- pnpm: string;
10
- bun: string;
7
+ readonly npm: readonly ["package-lock.json"];
8
+ readonly yarn: readonly ["yarn.lock"];
9
+ readonly pnpm: readonly ["pnpm-lock.yaml"];
10
+ readonly bun: readonly ["bun.lock", "bun.lockb"];
11
11
  };
12
12
  declare const packageManagers: PackageManager[];
13
13
  type PackageManager = keyof typeof lockfileNames;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as getInstallCommand, c as defaultJavaScriptRuntime, d as packageManagers, f as runtimes, i as getRuntime, l as defaultPackageManager, n as copyTemplate, o as getPackageManager, p as templates, r as getTemplate, s as getAppName, t as handler, u as lockfileNames } from "./handler-C71cBXgA.js";
1
+ import { a as getInstallCommand, c as defaultPackageManager, d as runtimes, f as templates, i as getRuntime, l as lockfileNames, n as copyTemplate, o as getPackageManager, p as getAppName, r as getTemplate, s as defaultJavaScriptRuntime, t as handler, u as packageManagers } from "./handler-BVAo8CHH.js";
2
2
  export { copyTemplate, defaultJavaScriptRuntime, defaultPackageManager, getAppName, getInstallCommand, getPackageManager, getRuntime, getTemplate, handler, lockfileNames, packageManagers, runtimes, templates };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "create-baeta",
3
- "version": "2.0.0-next.14",
3
+ "version": "2.0.0-next.15",
4
+ "description": "Scaffold new Baeta projects.",
4
5
  "keywords": [
5
6
  "baeta",
6
7
  "builder",
@@ -21,15 +22,15 @@
21
22
  },
22
23
  "repository": {
23
24
  "type": "git",
24
- "url": "https://github.com/andreisergiu98/baeta.git",
25
+ "url": "git+https://github.com/andreisergiu98/baeta.git",
25
26
  "directory": "packages/create-baeta"
26
27
  },
27
28
  "bin": "dist/cli.js",
28
29
  "files": [
29
- "dist",
30
- "package.json"
30
+ "dist"
31
31
  ],
32
32
  "type": "module",
33
+ "sideEffects": false,
33
34
  "types": "dist/index.d.ts",
34
35
  "exports": {
35
36
  ".": {
@@ -38,13 +39,13 @@
38
39
  }
39
40
  },
40
41
  "publishConfig": {
41
- "access": "public",
42
42
  "exports": {
43
43
  ".": {
44
44
  "types": "./dist/index.d.ts",
45
45
  "default": "./dist/index.js"
46
46
  }
47
- }
47
+ },
48
+ "access": "public"
48
49
  },
49
50
  "scripts": {
50
51
  "build": "yarn prebuild && builder build",
@@ -54,14 +55,15 @@
54
55
  "prepack": "builder prepare",
55
56
  "test": "builder test",
56
57
  "types": "yarn prebuild && tsc --noEmit",
57
- "write:apollo:versions": "builder print-resolved-versions ./meta/apollo/package.json -o versions.apollo.json",
58
- "write:yoga:versions": "builder print-resolved-versions ./meta/yoga/package.json -o versions.yoga.json"
58
+ "write:apollo:versions": "builder write-versions-manifest ./meta/apollo/package.json -o versions.apollo.json",
59
+ "write:yoga:versions": "builder write-versions-manifest ./meta/yoga/package.json -o versions.yoga.json"
59
60
  },
60
61
  "dependencies": {
61
62
  "@docusaurus/logger": "^3.10.1",
62
- "fs-extra": "^11.3.4",
63
- "prompts": "^2.4.2",
64
- "semver": "^7.7.4",
63
+ "@inquirer/input": "^5.1.0",
64
+ "@inquirer/select": "^5.2.0",
65
+ "fs-extra": "^11.3.5",
66
+ "semver": "^7.8.1",
65
67
  "shelljs": "^0.10.0",
66
68
  "supports-color": "^10.2.2",
67
69
  "yargs": "^18.0.0"
@@ -72,7 +74,6 @@
72
74
  "@baeta/tsconfig": "^0.0.0",
73
75
  "@types/fs-extra": "^11.0.4",
74
76
  "@types/node": "^22.19.17",
75
- "@types/prompts": "^2.4.9",
76
77
  "@types/semver": "^7.7.1",
77
78
  "@types/shelljs": "^0.10.0",
78
79
  "@types/yargs": "^17.0.35",
@@ -84,7 +85,7 @@
84
85
  ]
85
86
  },
86
87
  "engines": {
87
- "node": ">=22.20.0"
88
+ "node": "^22.20.0 || ^24.0.0 || >=26.0.0"
88
89
  },
89
90
  "typedocOptions": {
90
91
  "entryPoints": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler-C71cBXgA.js","names":["tsconfig","tsconfig.compilerOptions","apolloPackageJson","versions","yogaPackageJson","versions"],"sources":["../lib/constants.ts","../lib/app-name.ts","../lib/package-manager.ts","../lib/runtime.ts","../meta/apollo/package.json","../versions.apollo.json","../../../tools/tsconfig/tsconfig.json","../templates/shared.ts","../templates/apollo.ts","../meta/yoga/package.json","../versions.yoga.json","../templates/yoga.ts","../lib/templates.ts","../lib/handler.ts"],"sourcesContent":["export const defaultPackageManager = 'npm';\n\nexport const lockfileNames = {\n\tnpm: 'package-lock.json',\n\tyarn: 'yarn.lock',\n\tpnpm: 'pnpm-lock.yaml',\n\tbun: 'bun.lockb',\n};\n\nexport const packageManagers = Object.keys(lockfileNames) as PackageManager[];\n\nexport type PackageManager = keyof typeof lockfileNames;\n\nexport const runtimes = ['node', 'deno', 'bun'] as const;\n\nexport type JavaScriptRuntime = (typeof runtimes)[number];\n\nexport const defaultJavaScriptRuntime = 'node';\n\nexport const templates = ['yoga', 'apollo'] as const;\nexport type Template = (typeof templates)[number];\n","import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport fs from 'fs-extra';\nimport prompts from 'prompts';\n\nexport async function getAppName(reqName: string | undefined, rootDir: string): Promise<string> {\n\tasync function validateAppName(appName: string) {\n\t\tif (!appName) {\n\t\t\treturn 'An app name is required.';\n\t\t}\n\t\tconst dest = path.resolve(rootDir, appName);\n\t\tif (await fs.pathExists(dest)) {\n\t\t\treturn logger.interpolate`Directory already exists at path=${dest}!`;\n\t\t}\n\t\treturn true;\n\t}\n\n\tif (reqName) {\n\t\tconst res = await validateAppName(reqName);\n\t\tif (typeof res === 'string') {\n\t\t\tthrow new TypeError(res);\n\t\t}\n\t\treturn reqName;\n\t}\n\n\treturn await prompts(\n\t\t{\n\t\t\ttype: 'text',\n\t\t\tname: 'appName',\n\t\t\tmessage: 'What should we name this app?',\n\t\t\tinitial: 'baeta-app',\n\t\t\tvalidate: validateAppName,\n\t\t},\n\t\t{\n\t\t\tonCancel() {\n\t\t\t\tlogger.error('An app name is required.');\n\t\t\t\tprocess.exit(1);\n\t\t\t},\n\t\t},\n\t).then((result) => (result as { appName: string }).appName);\n}\n","import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport fs from 'fs-extra';\nimport prompts from 'prompts';\nimport shell from 'shelljs';\nimport type { CliOptions } from './cli-options.ts';\nimport {\n\tdefaultPackageManager,\n\tlockfileNames,\n\ttype PackageManager,\n\tpackageManagers,\n} from './constants.ts';\n\nasync function findPackageManagerFromLockFile(\n\trootDir: string,\n): Promise<PackageManager | undefined> {\n\tfor (const packageManager of packageManagers) {\n\t\tconst lockFilePath = path.join(rootDir, lockfileNames[packageManager]);\n\t\tif (await fs.pathExists(lockFilePath)) {\n\t\t\treturn packageManager;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction findPackageManagerFromUserAgent(): PackageManager | undefined {\n\treturn packageManagers.find((packageManager) =>\n\t\tprocess.env.npm_config_user_agent?.startsWith(packageManager),\n\t);\n}\n\nasync function askForPackageManagerChoice(): Promise<PackageManager> {\n\tconst hasYarn = shell.exec('yarn --version', { silent: true }).code === 0;\n\tconst hasPnpm = shell.exec('pnpm --version', { silent: true }).code === 0;\n\tconst hasBun = shell.exec('bun --version', { silent: true }).code === 0;\n\n\tif (!hasYarn && !hasPnpm && !hasBun) {\n\t\treturn 'npm';\n\t}\n\tconst choices = ['npm', hasYarn && 'yarn', hasPnpm && 'pnpm', hasBun && 'bun']\n\t\t.filter((p) => p !== false)\n\t\t.map((p) => ({ title: p, value: p }));\n\n\tconst manager = await prompts(\n\t\t{\n\t\t\ttype: 'select',\n\t\t\tname: 'packageManager',\n\t\t\tmessage: 'Select a package manager...',\n\t\t\tchoices,\n\t\t},\n\t\t{\n\t\t\tonCancel() {\n\t\t\t\tlogger.info`Falling back to name=${defaultPackageManager}`;\n\t\t\t},\n\t\t},\n\t).then((result) => (result as { packageManager?: PackageManager }).packageManager);\n\n\treturn manager ?? defaultPackageManager;\n}\n\nexport async function getPackageManager(\n\tdest: string,\n\t{ packageManager, skipInstall }: CliOptions,\n): Promise<PackageManager> {\n\tif (packageManager && !packageManagers.includes(packageManager)) {\n\t\tthrow new Error(\n\t\t\t`Invalid package manager choice ${packageManager}. Must be one of ${packageManagers.join(\n\t\t\t\t', ',\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tconst fromLockfile = await findPackageManagerFromLockFile(dest);\n\n\tif (fromLockfile) {\n\t\treturn fromLockfile;\n\t}\n\n\tif (packageManager) {\n\t\treturn packageManager;\n\t}\n\n\tconst fromLockfileInCwd = await findPackageManagerFromLockFile('.');\n\n\tif (fromLockfileInCwd) {\n\t\treturn fromLockfileInCwd;\n\t}\n\n\tconst fromUserAgent = findPackageManagerFromUserAgent();\n\n\tif (fromUserAgent) {\n\t\treturn fromUserAgent;\n\t}\n\n\tif (skipInstall) {\n\t\treturn defaultPackageManager;\n\t}\n\n\treturn await askForPackageManagerChoice();\n}\n\nexport function getInstallCommand(pkgManager: PackageManager): string {\n\tif (pkgManager === 'yarn') {\n\t\treturn 'yarn';\n\t}\n\tif (pkgManager === 'bun') {\n\t\treturn 'bun install';\n\t}\n\treturn `${pkgManager} install --color always`;\n}\n","import { logger } from '@docusaurus/logger';\nimport prompts from 'prompts';\nimport shell from 'shelljs';\nimport { defaultJavaScriptRuntime, type JavaScriptRuntime } from './constants.ts';\n\nexport async function getRuntime(): Promise<JavaScriptRuntime> {\n\tconst hasBun = shell.exec('bun --version', { silent: true }).code === 0;\n\tconst hasDeno = shell.exec('deno --version', { silent: true }).code === 0;\n\n\tif (!hasDeno && !hasBun) {\n\t\treturn 'node';\n\t}\n\tconst choices = ['node', hasBun && 'bun', hasDeno && 'deno']\n\t\t.filter((p) => p !== false)\n\t\t.map((p) => ({ title: p, value: p }));\n\n\tconst runtime = await prompts(\n\t\t{\n\t\t\ttype: 'select',\n\t\t\tname: 'runtime',\n\t\t\tmessage: 'Select a runtime...',\n\t\t\tchoices,\n\t\t},\n\t\t{\n\t\t\tonCancel() {\n\t\t\t\tlogger.info`Falling back to name=${defaultJavaScriptRuntime}`;\n\t\t\t},\n\t\t},\n\t).then((result) => (result as { runtime?: JavaScriptRuntime }).runtime);\n\n\treturn runtime ?? defaultJavaScriptRuntime;\n}\n","","","","import tsconfig from '../../../tools/tsconfig/tsconfig.json';\nimport type { JavaScriptRuntime } from '../lib/constants.ts';\nimport type { TemplateFile } from '../lib/template-file.ts';\n\nexport type PackageJson = {\n\tname: string;\n\tscripts: Record<string, string | undefined>;\n\tdependencies: Record<string, string | undefined>;\n\tdevDependencies: Record<string, string | undefined>;\n};\n\nexport type ResolvedPackageVersions = {\n\tdependencies: Record<string, string | undefined>;\n\tdevDependencies: Record<string, string | undefined>;\n\tpeerDependencies: Record<string, string | undefined>;\n};\n\nexport function makeSharedTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n\tpackageJson: PackageJson,\n\tversions: ResolvedPackageVersions,\n): TemplateFile[] {\n\treturn [\n\t\tmakePackageJson(appName, runtime, packageJson, versions),\n\t\t{\n\t\t\trelativePath: './tsconfig.json',\n\t\t\tcontent: JSON.stringify(\n\t\t\t\t{\n\t\t\t\t\t...tsconfig,\n\t\t\t\t\tcompilerOptions: {\n\t\t\t\t\t\t...tsconfig.compilerOptions,\n\t\t\t\t\t\trootDir: 'src',\n\t\t\t\t\t\toutDir: 'dist',\n\t\t\t\t\t\tnoEmit: true,\n\t\t\t\t\t\temitDeclarationOnly: false,\n\t\t\t\t\t},\n\t\t\t\t\texclude: ['baeta.ts'],\n\t\t\t\t},\n\t\t\t\tnull,\n\t\t\t\t2,\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/extensions.ts',\n\t\t\tcontent: `import { createExtensions } from '@baeta/core';\nimport { complexityExtension } from '@baeta/extension-complexity';\nimport type { Context } from '../types/context.ts';\n\nconst complexity = complexityExtension<Context>({\n\tdefaultComplexity: 1,\n\tdefaultListMultiplier: 10,\n\tasync limit(ctx) {\n\t\treturn {\n\t\t\tdepth: 10,\n\t\t\tbreadth: 50,\n\t\t\tcomplexity: 1000,\n\t\t};\n\t},\n});\n\nexport default createExtensions({\n\tcomplexityExtension: complexity\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user/user.gql',\n\t\t\tcontent: `type User {\n\tid: ID!\n\temail: String!\n\tlastName: String!\n\tprofile: String\n\tgivenName: String\n}\n\ninput UserWhereUniqueInput {\n\tid: ID!\n}\n\ntype Query {\n\tuser(where: UserWhereUniqueInput!): User\n\tusers: [User!]\n}\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user/index.ts',\n\t\t\tcontent: `import { UserModule } from './typedef.ts';\n\nconst { Query, User } = UserModule;\n\nconst userQuery = Query.user\n\t.$use(async (next, { args }) => {\n\t\tconst result = await next();\n\t\tconsole.log('Got user:', result, 'for args:', args);\n\t\treturn result;\n\t})\n\t.resolve(({ args }) => {\n\t\treturn {\n\t\t\tid: args.where.id,\n\t\t\temail: 'jon.doe@baeta.io',\n\t\t\tlastName: 'Doe',\n\t\t\tgivenName: null,\n\t\t\tprofile: null,\n\t\t};\n\t});\n\nconst usersQuery = Query.users.resolve(() => {\n\tconst users = Array.from({ length: 10 }).map((_, i) => ({\n\t\tid: i.toString(),\n\t\temail: \\`jon.doe\\${i}@baeta.io\\`,\n\t\tlastName: \\`Doe \\${i}\\`,\n\t\tgivenName: null,\n\t\tprofile: null,\n\t}));\n\treturn users;\n});\n\nexport default UserModule.$schema({\n\tUser: User.$fields({\n\t\tid: User.id.key('id'),\n\t\temail: User.email.key('email'),\n\t\tlastName: User.lastName.key('lastName'),\n\t\tgivenName: User.givenName.key('givenName').undefinedAsNull(),\n\t\tprofile: User.profile.key('profile').undefinedAsNull(),\n\t}),\n\tQuery: Query.$fields({\n\t\tuser: userQuery,\n\t\tusers: usersQuery,\n\t}),\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user-photos/user-photos.gql',\n\t\t\tcontent: `type UserPhoto {\n\tid: ID!\n\tuserId: ID!\n\turl: String!\n}\n\nextend type User {\n\tphotos: [UserPhoto!]\n}\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/user-photos/index.ts',\n\t\t\tcontent: `import { UserPhotosModule } from './typedef.ts';\n\nconst { User, UserPhoto } = UserPhotosModule;\n\nexport default UserPhotosModule.$schema({\n\tUser: User.$fields({\n\t\tphotos: User.photos.resolve(({ source }) => {\n\t\t\treturn Array.from({ length: 10 }).map((_, i) => ({\n\t\t\t\tid: \\`u\\${source.id}_p\\${i}\\`,\n\t\t\t\tuserId: source.id,\n\t\t\t\turl: \\`https://baeta.io/user/\\${source.id}/photo/\\${i}.png\\`,\n\t\t\t}));\n\t\t}),\n\t}),\n\tUserPhoto: UserPhoto.$fields({\n\t\tid: UserPhoto.id.key('id'),\n\t\turl: UserPhoto.url.key('url'),\n\t\tuserId: UserPhoto.userId.key('userId'),\n\t}),\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/modules/types.ts',\n\t\t\tcontent: `import type { GraphQLResolveInfo } from 'graphql';\nimport type { BaseObjectTypes, BaseScalars } from '../__generated__/utility.ts';\nimport type { Context } from '../types/context.ts';\n\nexport interface Scalars extends BaseScalars {}\n\nexport interface ObjectTypes extends BaseObjectTypes {\n\tUser: {\n\t\tid: string;\n\t\temail: string;\n\t\tlastName: string;\n\t\tgivenName?: string | null;\n\t\tprofile?: string | null;\n\t};\n}\n\nexport type Ctx = Context;\n\nexport type Info = GraphQLResolveInfo;\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './baeta.ts',\n\t\t\tcontent: `import { defineConfig } from '@baeta/cli';\n\nexport default defineConfig({\n\tgraphql: {\n\t\tschemas: ['src/**/*.gql'],\n\t},\n});\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './.gitignore',\n\t\t\tcontent: `# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# Snowpack dependency directory (https://snowpack.dev/)\nweb_modules/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional stylelint cache\n.stylelintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variable files\n.env\n.env.development.local\n.env.test.local\n.env.production.local\n.env.local\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n.parcel-cache\n\n# Next.js build output\n.next\nout\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n# Comment in the public line in if your project uses Gatsby and not Next.js\n# https://nextjs.org/blog/next-9-1#public-directory-support\n# public\n\n# vuepress build output\n.vuepress/dist\n\n# vuepress v2.x temp and cache directory\n.temp\n.cache\n\n# vitepress build output\n**/.vitepress/dist\n\n# vitepress cache directory\n**/.vitepress/cache\n\n# Docusaurus cache and generated files\n.docusaurus\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n\n# Stores VSCode versions used for testing VSCode extensions\n.vscode-test\n\n# yarn v2\n.yarn/cache\n.yarn/unplugged\n.yarn/build-state.yml\n.yarn/install-state.gz\n.pnp.*\n`,\n\t\t},\n\t];\n}\n\nfunction makePackageJson(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n\tpackageJson: {\n\t\tname: string;\n\t\tscripts: Record<string, string | undefined>;\n\t\tdependencies: Record<string, string | undefined>;\n\t\tdevDependencies: Record<string, string | undefined>;\n\t},\n\tversions: ResolvedPackageVersions,\n) {\n\tconst meta = structuredClone(packageJson);\n\tconst fields = ['dependencies', 'devDependencies'] as const;\n\tfor (const field of fields) {\n\t\tfor (const [dep, version] of Object.entries(versions[field] ?? {})) {\n\t\t\tmeta[field][dep] = version;\n\t\t}\n\t}\n\n\tif (runtime === 'node') {\n\t\tmeta.devDependencies['@types/bun'] = undefined;\n\t\tmeta.devDependencies['@types/deno'] = undefined;\n\t}\n\n\tif (runtime === 'bun') {\n\t\tmeta.scripts.start = `baeta generate --watch --run='bun --watch --inspect src/app.ts'`;\n\t\tmeta.devDependencies['@types/node'] = undefined;\n\t\tmeta.devDependencies['@types/deno'] = undefined;\n\t}\n\n\tif (runtime === 'deno') {\n\t\tmeta.scripts.start = `baeta generate --watch --run='deno --watch --allow-env --allow-read --allow-net src/app.ts'`;\n\t\tmeta.devDependencies['@types/node'] = undefined;\n\t\tmeta.devDependencies['@types/bun'] = undefined;\n\t}\n\n\tmeta.name = appName;\n\n\treturn {\n\t\trelativePath: './package.json',\n\t\tcontent: JSON.stringify(meta, null, 2),\n\t};\n}\n","import type { JavaScriptRuntime } from '../lib/constants.ts';\nimport type { TemplateFile } from '../lib/template-file.ts';\nimport apolloPackageJson from '../meta/apollo/package.json';\nimport versions from '../versions.apollo.json';\nimport { makeSharedTemplate } from './shared.ts';\n\nexport async function makeApolloTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n): Promise<TemplateFile[]> {\n\treturn [\n\t\t...makeSharedTemplate(appName, runtime, apolloPackageJson, versions),\n\t\t{\n\t\t\trelativePath: './src/types/context.ts',\n\t\t\tcontent: `export type Context = {\n\tuserId?: string;\n};\n`,\n\t\t},\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { ApolloServer } from '@apollo/server';\nimport { startStandaloneServer } from '@apollo/server/standalone';\nimport { createApplication } from '@baeta/core';\nimport modules from './modules/index.ts';\nimport type { Context } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nconst server = new ApolloServer<Context>({\n\tschema: baeta.schema,\n});\n\nconst { url } = await startStandaloneServer(server, {\n\tlisten: { port: 4000 },\n});\n\nconsole.log(\\`🚀 Server ready at: \\${url}\\`);\n`,\n\t\t},\n\t];\n}\n","","","import type { JavaScriptRuntime } from '../lib/constants.ts';\nimport type { TemplateFile } from '../lib/template-file.ts';\nimport yogaPackageJson from '../meta/yoga/package.json';\nimport versions from '../versions.yoga.json';\nimport { makeSharedTemplate } from './shared.ts';\n\nexport async function makeYogaTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n): Promise<TemplateFile[]> {\n\treturn [\n\t\t...makeSharedTemplate(appName, runtime, yogaPackageJson, versions),\n\t\t...makeRuntimeFiles(runtime),\n\t\t{\n\t\t\trelativePath: './src/types/context.ts',\n\t\t\tcontent: `export type Context = {\n\tappVersion: string;\n};\n\nexport type ServerContext = {};\n`,\n\t\t},\n\t];\n}\n\nfunction makeRuntimeFiles(runtime: JavaScriptRuntime): TemplateFile[] {\n\tswitch (runtime) {\n\t\tcase 'bun':\n\t\t\treturn makeBunFiles();\n\t\tcase 'deno':\n\t\t\treturn makeDenoFiles();\n\t\tcase 'node':\n\t\t\treturn makeNodeFiles();\n\t\tdefault:\n\t\t\treturn [] satisfies never[];\n\t}\n}\n\nfunction makeBunFiles(): TemplateFile[] {\n\treturn [\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { createApplication } from '@baeta/core';\nimport { createYoga } from 'graphql-yoga';\nimport modules from './modules/index.ts';\nimport type { Context, ServerContext } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nexport const yoga = createYoga<ServerContext, Context>({\n\tschema: baeta.schema,\n\tcontext: {\n\t\tappVersion: '1.0.0',\n\t},\n});\n\nBun.serve({\n\tfetch: yoga.fetch,\n\tport: 4000,\n});\n\nconsole.log(\\`🚀 Server ready at http://localhost:4000\\${yoga.graphqlEndpoint}\\`);\n`,\n\t\t},\n\t];\n}\n\nfunction makeDenoFiles(): TemplateFile[] {\n\treturn [\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { createApplication } from '@baeta/core';\nimport { createYoga } from 'graphql-yoga';\nimport modules from './modules/index.ts';\nimport type { Context, ServerContext } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nexport const yoga = createYoga<ServerContext, Context>({\n\tschema: baeta.schema,\n\tcontext: {\n\t\tappVersion: '1.0.0',\n\t},\n});\n\nDeno.serve(\n\t{\n\t\tport: 4000,\n\t\tonListen() {\n\t\t\tconsole.log(\\`🚀 Server ready at http://localhost:4000\\${yoga.graphqlEndpoint}\\`);\n\t\t},\n\t},\n\tyoga.fetch,\n);\n`,\n\t\t},\n\t];\n}\n\nfunction makeNodeFiles(): TemplateFile[] {\n\treturn [\n\t\t{\n\t\t\trelativePath: './src/app.ts',\n\t\t\tcontent: `import { createServer } from 'node:http';\nimport { createApplication } from '@baeta/core';\nimport { createYoga } from 'graphql-yoga';\nimport modules from './modules/index.ts';\nimport type { Context, ServerContext } from './types/context.ts';\n\nconst baeta = createApplication({\n\tmodules,\n});\n\nexport const yoga = createYoga<ServerContext, Context>({\n\tschema: baeta.schema,\n\tcontext: {\n\t\tappVersion: '1.0.0',\n\t},\n});\n\nconst server = createServer(yoga);\n\nserver.listen(4000, () => {\n\tconsole.log(\\`🚀 Server ready at http://localhost:4000\\${yoga.graphqlEndpoint}\\`);\n});\n`,\n\t\t},\n\t];\n}\n","import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport fs from 'fs-extra';\nimport prompts, { type Choice } from 'prompts';\nimport { makeApolloTemplate } from '../templates/apollo.ts';\nimport { makeYogaTemplate } from '../templates/yoga.ts';\nimport { type JavaScriptRuntime, type Template, templates } from './constants.ts';\n\nfunction createTemplateChoices(): Choice[] {\n\treturn templates.map((template) => ({ title: template, value: template }));\n}\n\nasync function askTemplateChoice() {\n\treturn await prompts(\n\t\t{\n\t\t\ttype: 'select',\n\t\t\tname: 'template',\n\t\t\tmessage: 'Select a template below...',\n\t\t\tchoices: createTemplateChoices(),\n\t\t},\n\t\t{\n\t\t\tonCancel() {\n\t\t\t\tlogger.error('A choice is required.');\n\t\t\t\tprocess.exit(1);\n\t\t\t},\n\t\t},\n\t).then((result) => {\n\t\treturn (result as { template: Template }).template;\n\t});\n}\n\nexport async function getTemplate(reqTemplate: string | undefined) {\n\tconst userProvided = reqTemplate ? templates.find((t) => t === reqTemplate) : null;\n\tconst template = userProvided ?? (await askTemplateChoice());\n\n\tif (!template) {\n\t\tthrow new Error('Template not found');\n\t}\n\n\treturn template;\n}\n\nfunction getTemplateFiles(template: Template, appName: string, runtime: JavaScriptRuntime) {\n\tswitch (template) {\n\t\tcase 'yoga':\n\t\t\treturn makeYogaTemplate(appName, runtime);\n\t\tcase 'apollo':\n\t\t\treturn makeApolloTemplate(appName, runtime);\n\t\tdefault:\n\t\t\treturn [] satisfies never[];\n\t}\n}\n\nexport async function copyTemplate(\n\tappName: string,\n\truntime: JavaScriptRuntime,\n\ttemplate: Template,\n\tdest: string,\n) {\n\tconst files = await getTemplateFiles(template, appName, runtime);\n\n\tconst promises = files.map((file) => {\n\t\tconst filePath = path.join(dest, file.relativePath);\n\t\treturn fs.ensureDir(path.dirname(filePath)).then(() => fs.writeFile(filePath, file.content));\n\t});\n\n\tawait Promise.all(promises);\n}\n","import path from 'node:path';\nimport { logger } from '@docusaurus/logger';\nimport shell from 'shelljs';\nimport supportsColor from 'supports-color';\nimport { getAppName } from './app-name.ts';\nimport type { PackageManager } from './constants.ts';\nimport { getInstallCommand, getPackageManager } from './package-manager.ts';\nimport { getRuntime } from './runtime.ts';\nimport { copyTemplate, getTemplate } from './templates.ts';\n\nexport interface Args {\n\tpackageManager?: PackageManager;\n\tskipInstall?: boolean;\n\tappName?: string;\n\ttemplate?: string;\n\trootDir: string;\n}\n\nexport async function handler(args: Args) {\n\tconst appName = await getAppName(args.appName, args.rootDir);\n\tconst dest = path.resolve(args.rootDir, appName);\n\n\tconst template = await getTemplate(args.template);\n\n\tconst runtime = await getRuntime();\n\n\tlogger.info('Creating new Baeta project...');\n\n\ttry {\n\t\tawait copyTemplate(appName, runtime, template, dest);\n\t} catch (err) {\n\t\tlogger.error`Copying Baeta template name=${template} failed!`;\n\t\tthrow err;\n\t}\n\n\tconst pkgManager = await getPackageManager(dest, args);\n\n\tconst useNpm = pkgManager === 'npm';\n\tconst useBun = pkgManager === 'bun';\n\tconst useRunCommand = useNpm || useBun;\n\tconst runCommand = useRunCommand ? 'run ' : '';\n\n\tconst start = `${pkgManager} start`;\n\tconst build = `${pkgManager} ${runCommand}build`;\n\tconst cd = `cd ${dest}`;\n\tconst install = `${pkgManager} install`;\n\n\tif (!args.skipInstall) {\n\t\tshell.cd(dest);\n\t\tlogger.info`Installing dependencies with name=${pkgManager}...`;\n\t\tconst result = shell.exec(getInstallCommand(pkgManager), {\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t...(supportsColor.stdout ? { FORCE_COLOR: '1' } : {}),\n\t\t\t},\n\t\t});\n\n\t\tif (result.code !== 0) {\n\t\t\tconsole.error('Dependency installation failed.');\n\t\t\tlogger.error('Dependency installation failed.');\n\t\t\tlogger.info`The app directory has already been created, and you can retry by typing:\n\ncode=${cd}\ncode=${install}`;\n\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n\n\tlogger.success`Created name=${dest}.`;\n\n\tlogger.info`Inside that directory, you can run several commands:\n\n code=${start}\n Starts the development server.\n\n code=${build}\n Generates the Baeta application.\n\nWe recommend that you begin by typing:\n\n code=${cd}\n code=${start}\n`;\n}\n"],"mappings":";;;;;;;AAAA,MAAa,wBAAwB;AAErC,MAAa,gBAAgB;CAC5B,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL;AAED,MAAa,kBAAkB,OAAO,KAAK,cAAc;AAIzD,MAAa,WAAW;CAAC;CAAQ;CAAQ;CAAM;AAI/C,MAAa,2BAA2B;AAExC,MAAa,YAAY,CAAC,QAAQ,SAAS;;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