@baeta/generator-sdk 0.0.14 → 0.1.0
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 +16 -0
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +16 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @baeta/generator-sdk
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#156](https://github.com/andreisergiu98/baeta/pull/156) [`01f3c20`](https://github.com/andreisergiu98/baeta/commit/01f3c20365539fad6e8a8694c59a8e86c95784e8) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - raise engine requirement to node >= 22
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#152](https://github.com/andreisergiu98/baeta/pull/152) [`d538c79`](https://github.com/andreisergiu98/baeta/commit/d538c7905e6ba96d9f294e2d528f9252e83acbe7) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update formatter
|
|
12
|
+
|
|
13
|
+
- [#145](https://github.com/andreisergiu98/baeta/pull/145) [`08428d4`](https://github.com/andreisergiu98/baeta/commit/08428d4f03b79cab9c116ff7b3a3cf9a0b2620f2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`01f3c20`](https://github.com/andreisergiu98/baeta/commit/01f3c20365539fad6e8a8694c59a8e86c95784e8), [`d538c79`](https://github.com/andreisergiu98/baeta/commit/d538c7905e6ba96d9f294e2d528f9252e83acbe7), [`08428d4`](https://github.com/andreisergiu98/baeta/commit/08428d4f03b79cab9c116ff7b3a3cf9a0b2620f2)]:
|
|
16
|
+
- @baeta/plugin@0.1.0
|
|
17
|
+
- @baeta/util-path@0.1.0
|
|
18
|
+
|
|
3
19
|
## 0.0.14
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -49,8 +49,8 @@ function resolveExtensionPath(modulesDir, moduleDefinitionName, extensionsPath)
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// lib/file.ts
|
|
52
|
-
|
|
53
52
|
var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
|
|
53
|
+
|
|
54
54
|
var File = (_class = class {
|
|
55
55
|
constructor(filename, content, tag, options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);
|
|
56
56
|
this.filename = filename;
|
|
@@ -288,6 +288,8 @@ function getGeneratorPlugins(plugins) {
|
|
|
288
288
|
|
|
289
289
|
// lib/watcher.ts
|
|
290
290
|
|
|
291
|
+
|
|
292
|
+
|
|
291
293
|
var _watcher = require('@parcel/watcher');
|
|
292
294
|
var _micromatch = require('micromatch'); var _micromatch2 = _interopRequireDefault(_micromatch);
|
|
293
295
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/config.ts","../lib/file.ts","../lib/file-block.ts","../lib/file-manager.ts","../lib/module.ts","../lib/plugin.ts","../lib/watcher.ts","../lib/watcher-ignore.ts"],"names":["dirname","GeneratorPluginVersion","path","posixPath","micromatch"],"mappings":";AAAA,SAAS,YAAY,MAAM,WAAW,UAAU,eAAe;AA6ExD,SAAS,YAAY,SAAuD;AACjF,QAAM,MAAM,UAAU,QAAQ,OAAO,QAAQ,IAAI,CAAC;AAClD,QAAM,UAAU,QAAQ,WAAW,CAAC,kBAAkB;AACtD,QAAM,aAAa,UAAU,QAAQ,KAAK,QAAQ,cAAc,aAAa,CAAC;AAC9E,QAAM,uBAAuB,QAAQ,wBAAwB;AAE7D,QAAM,uBAAuB,QAAQ,YAAY,2BAA2B;AAC5E,QAAM,gBAAgB,QAAQ,KAAK,QAAQ,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A,EACnC;AAAA,EAEA,SAAS,SAAuB;AAC9B,SAAK,cAAc,SAAS,OAAO;AAAA,EACrC;AAAA,EAEA,qBAAqB;AACnB,UAAM,UAAU,UAAU,KAAK,KAAK,KAAK,UAAU,KAAK,OAAO;AAE/D,UAAM,cAAc,YAAY;AAC9B,YAAM,eAAe,MAAM;AAC3B,YAAM,aAAa,YAAY;AAAA,IACjC;AAEA,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAAA,EAEA,QAAQ;AACN,WAAO,KAAK,aAAa,YAAY;AAAA,EACvC;AACF","sourcesContent":["import { isAbsolute, join, posixPath, relative, resolve } from '@baeta/util-path';\nimport { FileOptions } from './file';\n\n/**\n * Options for the graphql generator.\n */\nexport interface GeneratorOptions {\n /**\n * Current working directory.\n * @default process.cwd()\n */\n cwd?: string;\n\n /**\n * Glob pattern(s) to load graphql schema files.\n * @default ['src/∗∗/∗.graphql']\n */\n schemas: string[];\n\n /**\n * Directory where modules are defined.\n * @default 'src/modules'\n */\n modulesDir?: string;\n\n /**\n * Name for the generated module definition file. This will contain type definitions and the graphql ast.\n * @default 'typedef.ts'\n */\n moduleDefinitionName?: string;\n\n /**\n * Path for the generated base types file.\n * @default `${modulesDir}/../__generated__/types.ts`\n */\n baseTypesPath?: string;\n\n /**\n * Path where the context type is exported.\n * @example contextType: 'src/types/context#Context' // for named export\n * @example contextType: 'src/types/context' // for default export\n * @default undefined\n */\n contextType?: string;\n\n /**\n * Path where extensions (ex. auth-extension) are exported. Only default export is supported.\n * @example extensions: 'src/extensions'\n * @default undefined\n */\n extensions?: string;\n\n /**\n * Custom scalar mappings.\n * @example scalars: { DateTime: 'Date' }\n * @default undefined\n */\n scalars?: Record<string, string>;\n\n /**\n * Options for generated files.\n */\n fileOptions?: FileOptions;\n}\n\nexport interface NormalizedGeneratorOptions {\n cwd: string;\n schemas: string[];\n modulesDir: string;\n moduleDefinitionName: string;\n baseTypesPath: string;\n contextType?: string;\n extensions?: string;\n scalars?: Record<string, string>;\n fileOptions?: FileOptions;\n}\n\nexport function loadOptions(options: GeneratorOptions): NormalizedGeneratorOptions {\n const cwd = posixPath(options.cwd ?? process.cwd());\n const schemas = options.schemas ?? ['src/**/*.graphql'];\n const modulesDir = posixPath(resolve(cwd, options.modulesDir || 'src/modules'));\n const moduleDefinitionName = options.moduleDefinitionName || 'typedef.ts';\n\n const defaultBaseTypesRoot = resolve(modulesDir, '../__generated__/types.ts');\n const baseTypesRoot = resolve(cwd, options.baseTypesPath || defaultBaseTypesRoot);\n const baseTypesPath = posixPath(relative(modulesDir, baseTypesRoot));\n\n const contextType = resolveContextType(cwd, baseTypesRoot, options.contextType);\n const extensions = resolveExtensionPath(modulesDir, moduleDefinitionName, options.extensions);\n\n return {\n cwd,\n schemas,\n modulesDir,\n moduleDefinitionName,\n baseTypesPath,\n contextType,\n extensions,\n scalars: options.scalars,\n fileOptions: options.fileOptions,\n };\n}\n\nfunction resolveContextType(root: string, baseTypesRoot: string, contextType?: string) {\n if (!contextType) {\n return;\n }\n\n if (isAbsolute(contextType)) {\n return contextType;\n }\n\n if (contextType[0] === '!') {\n return contextType.slice(1);\n }\n\n const contextTypeRoot = resolve(root, contextType);\n\n return posixPath(relative(join(baseTypesRoot, '../'), contextTypeRoot));\n}\n\nfunction resolveExtensionPath(\n modulesDir: string,\n moduleDefinitionName: string,\n extensionsPath?: string,\n) {\n if (!extensionsPath) {\n return;\n }\n\n if (isAbsolute(extensionsPath)) {\n return extensionsPath;\n }\n\n if (extensionsPath[0] === '!') {\n return extensionsPath.slice(1);\n }\n\n return posixPath(relative(join(modulesDir, moduleDefinitionName), extensionsPath));\n}\n","import { dirname, extname } from '@baeta/util-path';\nimport fs from 'node:fs/promises';\n\n/**\n * Options for generated files.\n */\nexport interface FileOptions {\n /**\n * Add generation notice at the beginning of the file.\n * @default true\n */\n addGenerationNoticeHeader?: boolean;\n\n /**\n * Add eslint-disable comment at the beginning of the file.\n * @default true\n */\n addEslintDisableHeader?: boolean;\n\n /**\n * Add custom header at the beginning of the file.\n */\n addHeader?: (name: string, content: string, tag: string) => string;\n\n /**\n * Edit the content of the file before writing it.\n */\n transformContent?: (name: string, content: string, tag: string) => string | Promise<string>;\n}\n\nexport class File {\n persisted = false;\n\n constructor(\n public filename: string,\n public content: string,\n public tag: string,\n private options?: FileOptions,\n ) {}\n\n write = async () => {\n if (this.persisted) {\n return;\n }\n this.persisted = true;\n\n const dir = dirname(this.filename);\n await fs.mkdir(dir, { recursive: true });\n\n const content = await this.buildContent();\n\n return fs.writeFile(this.filename, content, 'utf-8');\n };\n\n unlink = async () => {\n this.persisted = false;\n return fs.unlink(this.filename);\n };\n\n protected async buildContent() {\n const content = this.buildHeader() + this.content;\n\n if (this.options?.transformContent) {\n return this.options.transformContent(this.filename, content, this.tag);\n }\n\n return content;\n }\n\n protected buildHeader() {\n const headerItems: string[] = [];\n\n if (this.options?.addGenerationNoticeHeader !== false) {\n const comment = this.createComment(\n 'This file was generated by Baeta. Do not edit it directly. All changes will be overwritten by the generator.',\n );\n headerItems.push(comment);\n }\n\n if (this.options?.addEslintDisableHeader !== false) {\n const comment = this.createComment('eslint-disable');\n headerItems.push(comment);\n }\n\n if (this.options?.addHeader) {\n const customHeader = this.options.addHeader(this.filename, this.content, this.tag);\n headerItems.push(customHeader);\n }\n\n if (headerItems.length === 0) {\n return '';\n }\n\n return `${headerItems.join('\\n')}\\n\\n`;\n }\n\n protected createComment(comment: string) {\n const extension = extname(this.filename);\n\n if (['.gql', '.graphql'].includes(extension)) {\n return `# ${comment}`;\n }\n\n return `/* ${comment} */`;\n }\n}\n","import { dirname } from '@baeta/util-path';\nimport { mkdir, open, writeFile } from 'node:fs/promises';\nimport { File, FileOptions } from './file';\n\nexport class FileBlock extends File {\n constructor(\n filename: string,\n content: string,\n protected start: string,\n protected end: string,\n tag: string,\n options?: FileOptions,\n ) {\n super(filename, content, tag, {\n addEslintDisableHeader: options?.addEslintDisableHeader ?? false,\n addGenerationNoticeHeader: options?.addGenerationNoticeHeader ?? false,\n });\n }\n\n write = async () => {\n if (this.persisted) {\n return;\n }\n this.persisted = true;\n\n const dir = dirname(this.filename);\n await mkdir(dir, { recursive: true });\n\n const [existingContent, fd] = await this.getExistingContent();\n this.addBlockToContent(existingContent);\n const content = await this.buildContent();\n\n if (fd) {\n await fd.write(content, 0, 'utf-8');\n await fd.close();\n } else {\n await writeFile(this.filename, content, 'utf-8');\n }\n };\n\n protected async getExistingContent() {\n try {\n const fd = await open(this.filename, 'r+');\n const existingContent = await fd.readFile('utf-8');\n return [existingContent, fd] as const;\n } catch (err) {\n return ['', null] as const;\n }\n }\n\n protected getSlices(existingContent: string) {\n const startMarkerIndex = existingContent.indexOf(this.start);\n const endMarkerIndex = existingContent.indexOf(this.end);\n\n if (startMarkerIndex === -1 || endMarkerIndex === -1) {\n return [existingContent, ''] as const;\n }\n\n return [\n existingContent.slice(0, startMarkerIndex),\n existingContent.slice(endMarkerIndex + this.end.length),\n ] as const;\n }\n\n protected addBlockToContent(existingContent: string) {\n const block = `${this.start}\\n${this.content}\\n${this.end}`;\n const padding = this.buildPadding(existingContent);\n const [startSlice, endSlice] = this.getSlices(existingContent);\n this.content = startSlice + padding + block + endSlice;\n }\n\n protected stripBlock(existingContent: string) {\n const [startSlice, endSlice] = this.getSlices(existingContent);\n return startSlice + endSlice;\n }\n\n protected buildPadding(existingContent: string) {\n const existingStripped = this.stripBlock(existingContent);\n\n if (existingStripped === '') {\n return '';\n }\n\n if (existingStripped.endsWith('\\n\\n')) {\n return '';\n }\n\n if (existingStripped.endsWith('\\n')) {\n return '\\n';\n }\n\n return '\\n\\n';\n }\n}\n","import { File, FileOptions } from './file';\n\nexport class FileManager {\n files: File[] = [];\n\n constructor(public fileOptions?: FileOptions) {}\n\n createAndAdd(filename: string, content: string, tag: string) {\n const file = new File(filename, content, tag, this.fileOptions);\n this.add(file);\n return file;\n }\n\n add(...file: File[]) {\n this.files.push(...file);\n }\n\n get(filename: string) {\n return this.files.find((file) => file.filename === filename);\n }\n\n getAll() {\n return this.files;\n }\n\n getByTag(tag: string) {\n return this.files.filter((file) => file.tag === tag);\n }\n\n remove(filename: string) {\n const index = this.files.findIndex((file) => file.filename === filename);\n this.files.splice(index, 1);\n }\n\n removeAll() {\n this.files = [];\n }\n\n removeByTag(tag: string) {\n this.files = this.files.filter((file) => file.tag !== tag);\n }\n\n writeAll() {\n const toWrite = this.files.filter((file) => !file.persisted);\n return Promise.all(toWrite.map((file) => file.write()));\n }\n\n writeByTag(tag: string) {\n const files = this.getByTag(tag);\n const toWrite = files.filter((file) => !file.persisted);\n return Promise.all(toWrite.map((file) => file.write()));\n }\n\n unlinkAll() {\n return Promise.all(this.files.map((file) => file.unlink())).then(() => {\n // void\n });\n }\n\n getPersistedFiles() {\n return this.files.filter((file) => file.persisted);\n }\n\n getPersistedFileNames() {\n return this.getPersistedFiles().map((file) => file.filename);\n }\n}\n","import { camelCase, pascalCase } from 'change-case-all';\n\nexport function getModuleGetName(name: string) {\n return `get${pascalCase(name)}Module`;\n}\n\nexport function getModuleCreateName(name: string) {\n return `create${pascalCase(name)}Module`;\n}\n\nexport function getModuleVariableName(name: string) {\n return camelCase(`${name}Module`);\n}\n","import { PluginType } from '@baeta/plugin';\nimport { NormalizedGeneratorOptions } from './config';\nimport { Ctx } from './ctx';\nimport { Watcher, WatcherFile } from './watcher';\n\nexport enum GeneratorPluginVersion {\n V1 = 'v1',\n}\n\nexport type GeneratorPluginV1Fn<Store = unknown> = (\n ctx: Ctx<Store>,\n next: () => Promise<void>,\n) => Promise<void>;\n\nexport type GeneratorPluginV1ReloadFn = (file: WatcherFile) => void;\n\nexport type GeneratorPluginV1WatchOptions = (\n options: NormalizedGeneratorOptions,\n watcher: Watcher,\n reload: GeneratorPluginV1ReloadFn,\n) => void;\n\nexport type GeneratorPluginV1Factory<Store = unknown> = {\n name: string;\n actionName: string;\n setup?: GeneratorPluginV1Fn<Store>;\n generate?: GeneratorPluginV1Fn<Store>;\n end?: GeneratorPluginV1Fn<Store>;\n watch?: GeneratorPluginV1WatchOptions;\n};\n\nexport interface GeneratorPluginV1<Store = unknown> {\n name: string;\n actionName: string;\n version: GeneratorPluginVersion.V1;\n type: PluginType.Generator;\n setup: GeneratorPluginV1Fn<Store>;\n generate: GeneratorPluginV1Fn<Store>;\n end: GeneratorPluginV1Fn<Store>;\n watch: GeneratorPluginV1WatchOptions;\n}\n\nconst defaultPluginFn: GeneratorPluginV1Fn<unknown> = async (ctx, next) => {\n return next();\n};\n\nconst defaultWatchFn = () => ({ include: [], ignore: [] });\n\nexport function createPluginV1<Store = {}>(\n options: GeneratorPluginV1Factory<Store>,\n): GeneratorPluginV1<Store> {\n return {\n name: options.name,\n actionName: options.actionName,\n version: GeneratorPluginVersion.V1,\n type: PluginType.Generator,\n end: options.end ?? defaultPluginFn,\n generate: options.generate ?? defaultPluginFn,\n setup: options.setup ?? defaultPluginFn,\n watch: options.watch ?? defaultWatchFn,\n };\n}\n\nexport function isGeneratorPlugin(plugin: {\n type: PluginType;\n}): plugin is GeneratorPluginV1<unknown> {\n return plugin.type === PluginType.Generator;\n}\n\nexport function getGeneratorPlugins(plugins?: Array<{ type: PluginType }>) {\n if (!plugins) {\n return [];\n }\n return plugins.filter(isGeneratorPlugin);\n}\n","import path, { posixPath } from '@baeta/util-path';\nimport { AsyncSubscription, Event, EventType, Options, subscribe } from '@parcel/watcher';\nimport micromatch from 'micromatch';\nimport { MatchPattern, WatcherIgnore } from './watcher-ignore';\n\nexport { micromatch };\nexport const isMatch = micromatch.isMatch;\n\nexport type WatcherListener = (path: WatcherFile) => void;\n\nexport interface WatcherFile {\n type: EventType;\n path: string;\n relativePath: string;\n}\nexport class Watcher {\n private subscription: AsyncSubscription;\n\n private listeners: Record<EventType, WatcherListener[]> = {\n create: [],\n update: [],\n delete: [],\n };\n\n private watcherIgnore: WatcherIgnore;\n\n constructor(\n private readonly cwd: string,\n private readonly options?: Options,\n ) {\n this.watcherIgnore = new WatcherIgnore(cwd);\n this.subscription = this.createSubscription();\n }\n\n onEvents = (err: Error | null, events: Event[]) => {\n if (err) {\n console.error(err);\n return;\n }\n\n const filteredEvents = events.filter((event) => {\n return !this.watcherIgnore.isIgnored(posixPath(event.path));\n });\n\n for (const event of filteredEvents) {\n for (const listener of this.listeners[event.type]) {\n listener({\n type: event.type,\n path: posixPath(event.path),\n relativePath: posixPath(path.relative(this.cwd, event.path)),\n });\n }\n }\n };\n\n on(event: EventType, listener: WatcherListener) {\n this.listeners[event].push(listener);\n }\n\n off(event: EventType, listener: WatcherListener) {\n this.listeners[event] = this.listeners[event].filter((l) => l !== listener);\n }\n\n ignore(pattern: MatchPattern) {\n this.watcherIgnore.ignore(pattern);\n }\n\n unignore(pattern: MatchPattern) {\n this.watcherIgnore.unignore(pattern);\n }\n\n createSubscription() {\n const promise = subscribe(this.cwd, this.onEvents, this.options);\n\n const unsubscribe = async () => {\n const subscription = await promise;\n await subscription.unsubscribe();\n };\n\n return {\n unsubscribe,\n };\n }\n\n close() {\n return this.subscription.unsubscribe();\n }\n}\n","import path from '@baeta/util-path';\nimport micromatch from 'micromatch';\n\nexport type MatchFn = (testString: string) => boolean;\nexport type MatchPattern = string | RegExp | MatchFn;\n\nexport class WatcherIgnore {\n private files: string[] = [];\n private regexps: RegExp[] = [];\n private functions: MatchFn[] = [];\n\n private globs: MatchFn[] = [];\n private globsMap = new Map<string, MatchFn>();\n\n constructor(private readonly cwd: string) {}\n\n ignore(pattern: MatchPattern) {\n if (pattern instanceof RegExp) {\n this.regexps.push(pattern);\n return;\n }\n\n if (typeof pattern === 'function') {\n this.functions.push(pattern);\n return;\n }\n\n if (!this.isMicromatch(pattern)) {\n this.files.push(this.resolveFile(pattern));\n return;\n }\n\n this.globsMap.set(pattern, micromatch.matcher(pattern));\n this.globs = Array.from(this.globsMap.values());\n }\n\n isMicromatch(pattern: string) {\n const result = micromatch.scan(pattern);\n return result.isBrace || result.isGlobstar || result.isExtglob || result.isGlob;\n }\n\n resolveFile(file: string) {\n return path.isAbsolute(file) ? file : path.join(this.cwd, file);\n }\n\n unignore(pattern: MatchPattern) {\n if (pattern instanceof RegExp) {\n this.regexps = this.regexps.filter((p) => p !== pattern);\n return;\n }\n\n if (typeof pattern === 'function') {\n this.functions = this.functions.filter((p) => p !== pattern);\n return;\n }\n\n if (!this.isMicromatch(pattern)) {\n const file = this.resolveFile(pattern);\n this.files = this.files.filter((p) => p !== file);\n return;\n }\n\n this.globsMap.delete(pattern);\n this.globs = Array.from(this.globsMap.values());\n }\n\n isIgnored(path: string) {\n if (this.files.includes(path)) {\n return true;\n }\n\n if (this.globs.some((f) => f(path))) {\n return true;\n }\n\n if (this.regexps.some((r) => r.test(path))) {\n return true;\n }\n\n if (this.functions.some((f) => f(path))) {\n return true;\n }\n\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/baeta/baeta/packages/generator-sdk/dist/index.cjs","../lib/config.ts","../lib/file.ts","../lib/file-block.ts","../lib/file-manager.ts","../lib/module.ts","../lib/plugin.ts","../lib/watcher.ts","../lib/watcher-ignore.ts"],"names":["GeneratorPluginVersion","path","micromatch"],"mappings":"AAAA;ACAA,gGAA+D;AA6ExD,SAAS,WAAA,CAAY,OAAA,EAAuD;AAClF,EAAA,MAAM,IAAA,EAAM,iCAAA,iBAAU,OAAA,CAAQ,GAAA,UAAO,OAAA,CAAQ,GAAA,CAAI,GAAC,CAAA;AAClD,EAAA,MAAM,QAAA,mBAAU,OAAA,CAAQ,OAAA,UAAW,CAAC,kBAAkB,GAAA;AACtD,EAAA,MAAM,WAAA,EAAa,iCAAA,+BAAU,GAAQ,EAAK,OAAA,CAAQ,WAAA,GAAc,aAAa,CAAC,CAAA;AAC9E,EAAA,MAAM,qBAAA,EAAuB,OAAA,CAAQ,qBAAA,GAAwB,YAAA;AAE7D,EAAA,MAAM,qBAAA,EAAuB,+BAAA,UAAQ,EAAY,2BAA2B,CAAA;AAC5E,EAAA,MAAM,cAAA,EAAgB,+BAAA,GAAQ,EAAK,OAAA,CAAQ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AAA;AACL,MAAA;AACD,IAAA;AAEK,IAAA;AACE,MAAA;AACD,MAAA;AACL,MAAA;AACD,IAAA;AAEK,IAAA;AACA,IAAA;AACN,EAAA;AAEUD,EAAAA;AACL,IAAA;AACH,MAAA;AACD,IAAA;AAEI,IAAA;AACH,MAAA;AACD,IAAA;AAEI,IAAA;AACH,MAAA;AACD,IAAA;AAEI,IAAA;AACH,MAAA;AACD,IAAA;AAEO,IAAA;AACR,EAAA;AACD;ARsRY;AACA;AOhWC;AASA;AAWZ,EAAA;AACkB,IAAA;AACA,IAAA;AAEZ,IAAA;AACA,IAAA;AACN,EAAA;AAhBQ,EAAA;AAEA,mBAAA;AACC,IAAA;AACA,IAAA;AACA,IAAA;AACT,EAAA;AAEQ,EAAA;AAUR,mBAAA;AACK,IAAA;AACH,MAAA;AACA,MAAA;AACD,IAAA;AAEM,IAAA;AACL,MAAA;AACA,IAAA;AAED,IAAA;AACC,MAAA;AACC,QAAA;AACC,UAAA;AACA,UAAA;AACA,UAAA;AACA,QAAA;AACF,MAAA;AACD,IAAA;AACD,EAAA;AAEqB,EAAA;AACf,IAAA;AACN,EAAA;AAEI,EAAA;AACE,IAAA;AACN,EAAA;AAEO,EAAA;AACD,IAAA;AACN,EAAA;AAES,EAAA;AACH,IAAA;AACN,EAAA;AAEA,EAAA;AACO,IAAA;AAEA,IAAA;AACC,MAAA;AACA,MAAA;AACP,IAAA;AAEO,IAAA;AACN,MAAA;AACD,IAAA;AACD,EAAA;AAEQ,EAAA;AACA,IAAA;AACR,EAAA;AACD;AP2UY;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/baeta/baeta/packages/generator-sdk/dist/index.cjs","sourcesContent":[null,"import { isAbsolute, join, posixPath, relative, resolve } from '@baeta/util-path';\nimport type { FileOptions } from './file.ts';\n\n/**\n * Options for the graphql generator.\n */\nexport interface GeneratorOptions {\n\t/**\n\t * Current working directory.\n\t * @default process.cwd()\n\t */\n\tcwd?: string;\n\n\t/**\n\t * Glob pattern(s) to load graphql schema files.\n\t * @default ['src/∗∗/∗.graphql']\n\t */\n\tschemas: string[];\n\n\t/**\n\t * Directory where modules are defined.\n\t * @default 'src/modules'\n\t */\n\tmodulesDir?: string;\n\n\t/**\n\t * Name for the generated module definition file. This will contain type definitions and the graphql ast.\n\t * @default 'typedef.ts'\n\t */\n\tmoduleDefinitionName?: string;\n\n\t/**\n\t * Path for the generated base types file.\n\t * @default `${modulesDir}/../__generated__/types.ts`\n\t */\n\tbaseTypesPath?: string;\n\n\t/**\n\t * Path where the context type is exported.\n\t * @example contextType: 'src/types/context#Context' // for named export\n\t * @example contextType: 'src/types/context' // for default export\n\t * @default undefined\n\t */\n\tcontextType?: string;\n\n\t/**\n\t * Path where extensions (ex. auth-extension) are exported. Only default export is supported.\n\t * @example extensions: 'src/extensions'\n\t * @default undefined\n\t */\n\textensions?: string;\n\n\t/**\n\t * Custom scalar mappings.\n\t * @example scalars: { DateTime: 'Date' }\n\t * @default undefined\n\t */\n\tscalars?: Record<string, string>;\n\n\t/**\n\t * Options for generated files.\n\t */\n\tfileOptions?: FileOptions;\n}\n\nexport interface NormalizedGeneratorOptions {\n\tcwd: string;\n\tschemas: string[];\n\tmodulesDir: string;\n\tmoduleDefinitionName: string;\n\tbaseTypesPath: string;\n\tcontextType?: string;\n\textensions?: string;\n\tscalars?: Record<string, string>;\n\tfileOptions?: FileOptions;\n}\n\nexport function loadOptions(options: GeneratorOptions): NormalizedGeneratorOptions {\n\tconst cwd = posixPath(options.cwd ?? process.cwd());\n\tconst schemas = options.schemas ?? ['src/**/*.graphql'];\n\tconst modulesDir = posixPath(resolve(cwd, options.modulesDir || 'src/modules'));\n\tconst moduleDefinitionName = options.moduleDefinitionName || 'typedef.ts';\n\n\tconst defaultBaseTypesRoot = resolve(modulesDir, '../__generated__/types.ts');\n\tconst baseTypesRoot = resolve(cwd, options.baseTypesPath || defaultBaseTypesRoot);\n\tconst baseTypesPath = posixPath(relative(modulesDir, baseTypesRoot));\n\n\tconst contextType = resolveContextType(cwd, baseTypesRoot, options.contextType);\n\tconst extensions = resolveExtensionPath(modulesDir, moduleDefinitionName, options.extensions);\n\n\treturn {\n\t\tcwd,\n\t\tschemas,\n\t\tmodulesDir,\n\t\tmoduleDefinitionName,\n\t\tbaseTypesPath,\n\t\tcontextType,\n\t\textensions,\n\t\tscalars: options.scalars,\n\t\tfileOptions: options.fileOptions,\n\t};\n}\n\nfunction resolveContextType(root: string, baseTypesRoot: string, contextType?: string) {\n\tif (!contextType) {\n\t\treturn;\n\t}\n\n\tif (isAbsolute(contextType)) {\n\t\treturn contextType;\n\t}\n\n\tif (contextType[0] === '!') {\n\t\treturn contextType.slice(1);\n\t}\n\n\tconst contextTypeRoot = resolve(root, contextType);\n\n\treturn posixPath(relative(join(baseTypesRoot, '../'), contextTypeRoot));\n}\n\nfunction resolveExtensionPath(\n\tmodulesDir: string,\n\tmoduleDefinitionName: string,\n\textensionsPath?: string,\n) {\n\tif (!extensionsPath) {\n\t\treturn;\n\t}\n\n\tif (isAbsolute(extensionsPath)) {\n\t\treturn extensionsPath;\n\t}\n\n\tif (extensionsPath[0] === '!') {\n\t\treturn extensionsPath.slice(1);\n\t}\n\n\treturn posixPath(relative(join(modulesDir, moduleDefinitionName), extensionsPath));\n}\n","import fs from 'node:fs/promises';\nimport { dirname, extname } from '@baeta/util-path';\n\n/**\n * Options for generated files.\n */\nexport interface FileOptions {\n\t/**\n\t * Add generation notice at the beginning of the file.\n\t * @default true\n\t */\n\taddGenerationNoticeHeader?: boolean;\n\n\t/**\n\t * Add eslint-disable comment at the beginning of the file.\n\t * @default true\n\t */\n\taddEslintDisableHeader?: boolean;\n\n\t/**\n\t * Add custom header at the beginning of the file.\n\t */\n\taddHeader?: (name: string, content: string, tag: string) => string;\n\n\t/**\n\t * Edit the content of the file before writing it.\n\t */\n\ttransformContent?: (name: string, content: string, tag: string) => string | Promise<string>;\n}\n\nexport class File {\n\tpersisted = false;\n\n\tconstructor(\n\t\tpublic filename: string,\n\t\tpublic content: string,\n\t\tpublic tag: string,\n\t\tprivate options?: FileOptions,\n\t) {}\n\n\twrite = async () => {\n\t\tif (this.persisted) {\n\t\t\treturn;\n\t\t}\n\t\tthis.persisted = true;\n\n\t\tconst dir = dirname(this.filename);\n\t\tawait fs.mkdir(dir, { recursive: true });\n\n\t\tconst content = await this.buildContent();\n\n\t\treturn fs.writeFile(this.filename, content, 'utf-8');\n\t};\n\n\tunlink = async () => {\n\t\tthis.persisted = false;\n\t\treturn fs.unlink(this.filename);\n\t};\n\n\tprotected async buildContent() {\n\t\tconst content = this.buildHeader() + this.content;\n\n\t\tif (this.options?.transformContent) {\n\t\t\treturn this.options.transformContent(this.filename, content, this.tag);\n\t\t}\n\n\t\treturn content;\n\t}\n\n\tprotected buildHeader() {\n\t\tconst headerItems: string[] = [];\n\n\t\tif (this.options?.addGenerationNoticeHeader !== false) {\n\t\t\tconst comment = this.createComment(\n\t\t\t\t'This file was generated by Baeta. Do not edit it directly. All changes will be overwritten by the generator.',\n\t\t\t);\n\t\t\theaderItems.push(comment);\n\t\t}\n\n\t\tif (this.options?.addEslintDisableHeader !== false) {\n\t\t\tconst comment = this.createComment('eslint-disable');\n\t\t\theaderItems.push(comment);\n\t\t}\n\n\t\tif (this.options?.addHeader) {\n\t\t\tconst customHeader = this.options.addHeader(this.filename, this.content, this.tag);\n\t\t\theaderItems.push(customHeader);\n\t\t}\n\n\t\tif (headerItems.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn `${headerItems.join('\\n')}\\n\\n`;\n\t}\n\n\tprotected createComment(comment: string) {\n\t\tconst extension = extname(this.filename);\n\n\t\tif (['.gql', '.graphql'].includes(extension)) {\n\t\t\treturn `# ${comment}`;\n\t\t}\n\n\t\treturn `/* ${comment} */`;\n\t}\n}\n","import { mkdir, open, writeFile } from 'node:fs/promises';\nimport { dirname } from '@baeta/util-path';\nimport { File, type FileOptions } from './file.ts';\n\nexport class FileBlock extends File {\n\tconstructor(\n\t\tfilename: string,\n\t\tcontent: string,\n\t\tprotected start: string,\n\t\tprotected end: string,\n\t\ttag: string,\n\t\toptions?: FileOptions,\n\t) {\n\t\tsuper(filename, content, tag, {\n\t\t\taddEslintDisableHeader: options?.addEslintDisableHeader ?? false,\n\t\t\taddGenerationNoticeHeader: options?.addGenerationNoticeHeader ?? false,\n\t\t});\n\t}\n\n\twrite = async () => {\n\t\tif (this.persisted) {\n\t\t\treturn;\n\t\t}\n\t\tthis.persisted = true;\n\n\t\tconst dir = dirname(this.filename);\n\t\tawait mkdir(dir, { recursive: true });\n\n\t\tconst [existingContent, fd] = await this.getExistingContent();\n\t\tthis.addBlockToContent(existingContent);\n\t\tconst content = await this.buildContent();\n\n\t\tif (fd) {\n\t\t\tawait fd.write(content, 0, 'utf-8');\n\t\t\tawait fd.close();\n\t\t} else {\n\t\t\tawait writeFile(this.filename, content, 'utf-8');\n\t\t}\n\t};\n\n\tprotected async getExistingContent() {\n\t\ttry {\n\t\t\tconst fd = await open(this.filename, 'r+');\n\t\t\tconst existingContent = await fd.readFile('utf-8');\n\t\t\treturn [existingContent, fd] as const;\n\t\t} catch (err) {\n\t\t\treturn ['', null] as const;\n\t\t}\n\t}\n\n\tprotected getSlices(existingContent: string) {\n\t\tconst startMarkerIndex = existingContent.indexOf(this.start);\n\t\tconst endMarkerIndex = existingContent.indexOf(this.end);\n\n\t\tif (startMarkerIndex === -1 || endMarkerIndex === -1) {\n\t\t\treturn [existingContent, ''] as const;\n\t\t}\n\n\t\treturn [\n\t\t\texistingContent.slice(0, startMarkerIndex),\n\t\t\texistingContent.slice(endMarkerIndex + this.end.length),\n\t\t] as const;\n\t}\n\n\tprotected addBlockToContent(existingContent: string) {\n\t\tconst block = `${this.start}\\n${this.content}\\n${this.end}`;\n\t\tconst padding = this.buildPadding(existingContent);\n\t\tconst [startSlice, endSlice] = this.getSlices(existingContent);\n\t\tthis.content = startSlice + padding + block + endSlice;\n\t}\n\n\tprotected stripBlock(existingContent: string) {\n\t\tconst [startSlice, endSlice] = this.getSlices(existingContent);\n\t\treturn startSlice + endSlice;\n\t}\n\n\tprotected buildPadding(existingContent: string) {\n\t\tconst existingStripped = this.stripBlock(existingContent);\n\n\t\tif (existingStripped === '') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (existingStripped.endsWith('\\n\\n')) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (existingStripped.endsWith('\\n')) {\n\t\t\treturn '\\n';\n\t\t}\n\n\t\treturn '\\n\\n';\n\t}\n}\n","import { File, type FileOptions } from './file.ts';\n\nexport class FileManager {\n\tfiles: File[] = [];\n\n\tconstructor(public fileOptions?: FileOptions) {}\n\n\tcreateAndAdd(filename: string, content: string, tag: string) {\n\t\tconst file = new File(filename, content, tag, this.fileOptions);\n\t\tthis.add(file);\n\t\treturn file;\n\t}\n\n\tadd(...file: File[]) {\n\t\tthis.files.push(...file);\n\t}\n\n\tget(filename: string) {\n\t\treturn this.files.find((file) => file.filename === filename);\n\t}\n\n\tgetAll() {\n\t\treturn this.files;\n\t}\n\n\tgetByTag(tag: string) {\n\t\treturn this.files.filter((file) => file.tag === tag);\n\t}\n\n\tremove(filename: string) {\n\t\tconst index = this.files.findIndex((file) => file.filename === filename);\n\t\tthis.files.splice(index, 1);\n\t}\n\n\tremoveAll() {\n\t\tthis.files = [];\n\t}\n\n\tremoveByTag(tag: string) {\n\t\tthis.files = this.files.filter((file) => file.tag !== tag);\n\t}\n\n\twriteAll() {\n\t\tconst toWrite = this.files.filter((file) => !file.persisted);\n\t\treturn Promise.all(toWrite.map((file) => file.write()));\n\t}\n\n\twriteByTag(tag: string) {\n\t\tconst files = this.getByTag(tag);\n\t\tconst toWrite = files.filter((file) => !file.persisted);\n\t\treturn Promise.all(toWrite.map((file) => file.write()));\n\t}\n\n\tunlinkAll() {\n\t\treturn Promise.all(this.files.map((file) => file.unlink())).then(() => {\n\t\t\t// void\n\t\t});\n\t}\n\n\tgetPersistedFiles() {\n\t\treturn this.files.filter((file) => file.persisted);\n\t}\n\n\tgetPersistedFileNames() {\n\t\treturn this.getPersistedFiles().map((file) => file.filename);\n\t}\n}\n","import { camelCase, pascalCase } from 'change-case-all';\n\nexport function getModuleGetName(name: string) {\n\treturn `get${pascalCase(name)}Module`;\n}\n\nexport function getModuleCreateName(name: string) {\n\treturn `create${pascalCase(name)}Module`;\n}\n\nexport function getModuleVariableName(name: string) {\n\treturn camelCase(`${name}Module`);\n}\n","import { PluginType } from '@baeta/plugin';\nimport type { NormalizedGeneratorOptions } from './config.ts';\nimport type { Ctx } from './ctx.ts';\nimport type { Watcher, WatcherFile } from './watcher.ts';\n\nexport enum GeneratorPluginVersion {\n\tV1 = 'v1',\n}\n\nexport type GeneratorPluginV1Fn<Store = unknown> = (\n\tctx: Ctx<Store>,\n\tnext: () => Promise<void>,\n) => Promise<void>;\n\nexport type GeneratorPluginV1ReloadFn = (file: WatcherFile) => void;\n\nexport type GeneratorPluginV1WatchOptions = (\n\toptions: NormalizedGeneratorOptions,\n\twatcher: Watcher,\n\treload: GeneratorPluginV1ReloadFn,\n) => void;\n\nexport type GeneratorPluginV1Factory<Store = unknown> = {\n\tname: string;\n\tactionName: string;\n\tsetup?: GeneratorPluginV1Fn<Store>;\n\tgenerate?: GeneratorPluginV1Fn<Store>;\n\tend?: GeneratorPluginV1Fn<Store>;\n\twatch?: GeneratorPluginV1WatchOptions;\n};\n\nexport interface GeneratorPluginV1<Store = unknown> {\n\tname: string;\n\tactionName: string;\n\tversion: GeneratorPluginVersion.V1;\n\ttype: PluginType.Generator;\n\tsetup: GeneratorPluginV1Fn<Store>;\n\tgenerate: GeneratorPluginV1Fn<Store>;\n\tend: GeneratorPluginV1Fn<Store>;\n\twatch: GeneratorPluginV1WatchOptions;\n}\n\nconst defaultPluginFn: GeneratorPluginV1Fn<unknown> = async (ctx, next) => {\n\treturn next();\n};\n\nconst defaultWatchFn = () => ({ include: [], ignore: [] });\n\nexport function createPluginV1<Store = {}>(\n\toptions: GeneratorPluginV1Factory<Store>,\n): GeneratorPluginV1<Store> {\n\treturn {\n\t\tname: options.name,\n\t\tactionName: options.actionName,\n\t\tversion: GeneratorPluginVersion.V1,\n\t\ttype: PluginType.Generator,\n\t\tend: options.end ?? defaultPluginFn,\n\t\tgenerate: options.generate ?? defaultPluginFn,\n\t\tsetup: options.setup ?? defaultPluginFn,\n\t\twatch: options.watch ?? defaultWatchFn,\n\t};\n}\n\nexport function isGeneratorPlugin(plugin: {\n\ttype: PluginType;\n}): plugin is GeneratorPluginV1<unknown> {\n\treturn plugin.type === PluginType.Generator;\n}\n\nexport function getGeneratorPlugins(plugins?: Array<{ type: PluginType }>) {\n\tif (!plugins) {\n\t\treturn [];\n\t}\n\treturn plugins.filter(isGeneratorPlugin);\n}\n","import path, { posixPath } from '@baeta/util-path';\nimport {\n\ttype AsyncSubscription,\n\ttype Event,\n\ttype EventType,\n\ttype Options,\n\tsubscribe,\n} from '@parcel/watcher';\nimport micromatch from 'micromatch';\nimport { type MatchPattern, WatcherIgnore } from './watcher-ignore.ts';\n\nexport { micromatch };\nexport const isMatch = micromatch.isMatch;\n\nexport type WatcherListener = (path: WatcherFile) => void;\n\nexport interface WatcherFile {\n\ttype: EventType;\n\tpath: string;\n\trelativePath: string;\n}\nexport class Watcher {\n\tprivate subscription: AsyncSubscription;\n\n\tprivate listeners: Record<EventType, WatcherListener[]> = {\n\t\tcreate: [],\n\t\tupdate: [],\n\t\tdelete: [],\n\t};\n\n\tprivate watcherIgnore: WatcherIgnore;\n\n\tconstructor(\n\t\tprivate readonly cwd: string,\n\t\tprivate readonly options?: Options,\n\t) {\n\t\tthis.watcherIgnore = new WatcherIgnore(cwd);\n\t\tthis.subscription = this.createSubscription();\n\t}\n\n\tonEvents = (err: Error | null, events: Event[]) => {\n\t\tif (err) {\n\t\t\tconsole.error(err);\n\t\t\treturn;\n\t\t}\n\n\t\tconst filteredEvents = events.filter((event) => {\n\t\t\treturn !this.watcherIgnore.isIgnored(posixPath(event.path));\n\t\t});\n\n\t\tfor (const event of filteredEvents) {\n\t\t\tfor (const listener of this.listeners[event.type]) {\n\t\t\t\tlistener({\n\t\t\t\t\ttype: event.type,\n\t\t\t\t\tpath: posixPath(event.path),\n\t\t\t\t\trelativePath: posixPath(path.relative(this.cwd, event.path)),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n\ton(event: EventType, listener: WatcherListener) {\n\t\tthis.listeners[event].push(listener);\n\t}\n\n\toff(event: EventType, listener: WatcherListener) {\n\t\tthis.listeners[event] = this.listeners[event].filter((l) => l !== listener);\n\t}\n\n\tignore(pattern: MatchPattern) {\n\t\tthis.watcherIgnore.ignore(pattern);\n\t}\n\n\tunignore(pattern: MatchPattern) {\n\t\tthis.watcherIgnore.unignore(pattern);\n\t}\n\n\tcreateSubscription() {\n\t\tconst promise = subscribe(this.cwd, this.onEvents, this.options);\n\n\t\tconst unsubscribe = async () => {\n\t\t\tconst subscription = await promise;\n\t\t\tawait subscription.unsubscribe();\n\t\t};\n\n\t\treturn {\n\t\t\tunsubscribe,\n\t\t};\n\t}\n\n\tclose() {\n\t\treturn this.subscription.unsubscribe();\n\t}\n}\n","import path from '@baeta/util-path';\nimport micromatch from 'micromatch';\n\nexport type MatchFn = (testString: string) => boolean;\nexport type MatchPattern = string | RegExp | MatchFn;\n\nexport class WatcherIgnore {\n\tprivate files: string[] = [];\n\tprivate regexps: RegExp[] = [];\n\tprivate functions: MatchFn[] = [];\n\n\tprivate globs: MatchFn[] = [];\n\tprivate globsMap = new Map<string, MatchFn>();\n\n\tconstructor(private readonly cwd: string) {}\n\n\tignore(pattern: MatchPattern) {\n\t\tif (pattern instanceof RegExp) {\n\t\t\tthis.regexps.push(pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof pattern === 'function') {\n\t\t\tthis.functions.push(pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.isMicromatch(pattern)) {\n\t\t\tthis.files.push(this.resolveFile(pattern));\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globsMap.set(pattern, micromatch.matcher(pattern));\n\t\tthis.globs = Array.from(this.globsMap.values());\n\t}\n\n\tisMicromatch(pattern: string) {\n\t\tconst result = micromatch.scan(pattern);\n\t\treturn result.isBrace || result.isGlobstar || result.isExtglob || result.isGlob;\n\t}\n\n\tresolveFile(file: string) {\n\t\treturn path.isAbsolute(file) ? file : path.join(this.cwd, file);\n\t}\n\n\tunignore(pattern: MatchPattern) {\n\t\tif (pattern instanceof RegExp) {\n\t\t\tthis.regexps = this.regexps.filter((p) => p !== pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof pattern === 'function') {\n\t\t\tthis.functions = this.functions.filter((p) => p !== pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.isMicromatch(pattern)) {\n\t\t\tconst file = this.resolveFile(pattern);\n\t\t\tthis.files = this.files.filter((p) => p !== file);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globsMap.delete(pattern);\n\t\tthis.globs = Array.from(this.globsMap.values());\n\t}\n\n\tisIgnored(path: string) {\n\t\tif (this.files.includes(path)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.globs.some((f) => f(path))) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.regexps.some((r) => r.test(path))) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.functions.some((f) => f(path))) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -49,8 +49,8 @@ function resolveExtensionPath(modulesDir, moduleDefinitionName, extensionsPath)
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// lib/file.ts
|
|
52
|
-
import { dirname, extname } from "@baeta/util-path";
|
|
53
52
|
import fs from "node:fs/promises";
|
|
53
|
+
import { dirname, extname } from "@baeta/util-path";
|
|
54
54
|
var File = class {
|
|
55
55
|
constructor(filename, content, tag, options) {
|
|
56
56
|
this.filename = filename;
|
|
@@ -113,8 +113,8 @@ var File = class {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
// lib/file-block.ts
|
|
116
|
-
import { dirname as dirname2 } from "@baeta/util-path";
|
|
117
116
|
import { mkdir, open, writeFile } from "node:fs/promises";
|
|
117
|
+
import { dirname as dirname2 } from "@baeta/util-path";
|
|
118
118
|
var FileBlock = class extends File {
|
|
119
119
|
constructor(filename, content, start, end, tag, options) {
|
|
120
120
|
super(filename, content, tag, {
|
|
@@ -288,7 +288,9 @@ function getGeneratorPlugins(plugins) {
|
|
|
288
288
|
|
|
289
289
|
// lib/watcher.ts
|
|
290
290
|
import path2, { posixPath as posixPath2 } from "@baeta/util-path";
|
|
291
|
-
import {
|
|
291
|
+
import {
|
|
292
|
+
subscribe
|
|
293
|
+
} from "@parcel/watcher";
|
|
292
294
|
import micromatch2 from "micromatch";
|
|
293
295
|
|
|
294
296
|
// lib/watcher-ignore.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/config.ts","../lib/file.ts","../lib/file-block.ts","../lib/file-manager.ts","../lib/module.ts","../lib/plugin.ts","../lib/watcher.ts","../lib/watcher-ignore.ts"],"sourcesContent":["import { isAbsolute, join, posixPath, relative, resolve } from '@baeta/util-path';\nimport { FileOptions } from './file';\n\n/**\n * Options for the graphql generator.\n */\nexport interface GeneratorOptions {\n /**\n * Current working directory.\n * @default process.cwd()\n */\n cwd?: string;\n\n /**\n * Glob pattern(s) to load graphql schema files.\n * @default ['src/∗∗/∗.graphql']\n */\n schemas: string[];\n\n /**\n * Directory where modules are defined.\n * @default 'src/modules'\n */\n modulesDir?: string;\n\n /**\n * Name for the generated module definition file. This will contain type definitions and the graphql ast.\n * @default 'typedef.ts'\n */\n moduleDefinitionName?: string;\n\n /**\n * Path for the generated base types file.\n * @default `${modulesDir}/../__generated__/types.ts`\n */\n baseTypesPath?: string;\n\n /**\n * Path where the context type is exported.\n * @example contextType: 'src/types/context#Context' // for named export\n * @example contextType: 'src/types/context' // for default export\n * @default undefined\n */\n contextType?: string;\n\n /**\n * Path where extensions (ex. auth-extension) are exported. Only default export is supported.\n * @example extensions: 'src/extensions'\n * @default undefined\n */\n extensions?: string;\n\n /**\n * Custom scalar mappings.\n * @example scalars: { DateTime: 'Date' }\n * @default undefined\n */\n scalars?: Record<string, string>;\n\n /**\n * Options for generated files.\n */\n fileOptions?: FileOptions;\n}\n\nexport interface NormalizedGeneratorOptions {\n cwd: string;\n schemas: string[];\n modulesDir: string;\n moduleDefinitionName: string;\n baseTypesPath: string;\n contextType?: string;\n extensions?: string;\n scalars?: Record<string, string>;\n fileOptions?: FileOptions;\n}\n\nexport function loadOptions(options: GeneratorOptions): NormalizedGeneratorOptions {\n const cwd = posixPath(options.cwd ?? process.cwd());\n const schemas = options.schemas ?? ['src/**/*.graphql'];\n const modulesDir = posixPath(resolve(cwd, options.modulesDir || 'src/modules'));\n const moduleDefinitionName = options.moduleDefinitionName || 'typedef.ts';\n\n const defaultBaseTypesRoot = resolve(modulesDir, '../__generated__/types.ts');\n const baseTypesRoot = resolve(cwd, options.baseTypesPath || defaultBaseTypesRoot);\n const baseTypesPath = posixPath(relative(modulesDir, baseTypesRoot));\n\n const contextType = resolveContextType(cwd, baseTypesRoot, options.contextType);\n const extensions = resolveExtensionPath(modulesDir, moduleDefinitionName, options.extensions);\n\n return {\n cwd,\n schemas,\n modulesDir,\n moduleDefinitionName,\n baseTypesPath,\n contextType,\n extensions,\n scalars: options.scalars,\n fileOptions: options.fileOptions,\n };\n}\n\nfunction resolveContextType(root: string, baseTypesRoot: string, contextType?: string) {\n if (!contextType) {\n return;\n }\n\n if (isAbsolute(contextType)) {\n return contextType;\n }\n\n if (contextType[0] === '!') {\n return contextType.slice(1);\n }\n\n const contextTypeRoot = resolve(root, contextType);\n\n return posixPath(relative(join(baseTypesRoot, '../'), contextTypeRoot));\n}\n\nfunction resolveExtensionPath(\n modulesDir: string,\n moduleDefinitionName: string,\n extensionsPath?: string,\n) {\n if (!extensionsPath) {\n return;\n }\n\n if (isAbsolute(extensionsPath)) {\n return extensionsPath;\n }\n\n if (extensionsPath[0] === '!') {\n return extensionsPath.slice(1);\n }\n\n return posixPath(relative(join(modulesDir, moduleDefinitionName), extensionsPath));\n}\n","import { dirname, extname } from '@baeta/util-path';\nimport fs from 'node:fs/promises';\n\n/**\n * Options for generated files.\n */\nexport interface FileOptions {\n /**\n * Add generation notice at the beginning of the file.\n * @default true\n */\n addGenerationNoticeHeader?: boolean;\n\n /**\n * Add eslint-disable comment at the beginning of the file.\n * @default true\n */\n addEslintDisableHeader?: boolean;\n\n /**\n * Add custom header at the beginning of the file.\n */\n addHeader?: (name: string, content: string, tag: string) => string;\n\n /**\n * Edit the content of the file before writing it.\n */\n transformContent?: (name: string, content: string, tag: string) => string | Promise<string>;\n}\n\nexport class File {\n persisted = false;\n\n constructor(\n public filename: string,\n public content: string,\n public tag: string,\n private options?: FileOptions,\n ) {}\n\n write = async () => {\n if (this.persisted) {\n return;\n }\n this.persisted = true;\n\n const dir = dirname(this.filename);\n await fs.mkdir(dir, { recursive: true });\n\n const content = await this.buildContent();\n\n return fs.writeFile(this.filename, content, 'utf-8');\n };\n\n unlink = async () => {\n this.persisted = false;\n return fs.unlink(this.filename);\n };\n\n protected async buildContent() {\n const content = this.buildHeader() + this.content;\n\n if (this.options?.transformContent) {\n return this.options.transformContent(this.filename, content, this.tag);\n }\n\n return content;\n }\n\n protected buildHeader() {\n const headerItems: string[] = [];\n\n if (this.options?.addGenerationNoticeHeader !== false) {\n const comment = this.createComment(\n 'This file was generated by Baeta. Do not edit it directly. All changes will be overwritten by the generator.',\n );\n headerItems.push(comment);\n }\n\n if (this.options?.addEslintDisableHeader !== false) {\n const comment = this.createComment('eslint-disable');\n headerItems.push(comment);\n }\n\n if (this.options?.addHeader) {\n const customHeader = this.options.addHeader(this.filename, this.content, this.tag);\n headerItems.push(customHeader);\n }\n\n if (headerItems.length === 0) {\n return '';\n }\n\n return `${headerItems.join('\\n')}\\n\\n`;\n }\n\n protected createComment(comment: string) {\n const extension = extname(this.filename);\n\n if (['.gql', '.graphql'].includes(extension)) {\n return `# ${comment}`;\n }\n\n return `/* ${comment} */`;\n }\n}\n","import { dirname } from '@baeta/util-path';\nimport { mkdir, open, writeFile } from 'node:fs/promises';\nimport { File, FileOptions } from './file';\n\nexport class FileBlock extends File {\n constructor(\n filename: string,\n content: string,\n protected start: string,\n protected end: string,\n tag: string,\n options?: FileOptions,\n ) {\n super(filename, content, tag, {\n addEslintDisableHeader: options?.addEslintDisableHeader ?? false,\n addGenerationNoticeHeader: options?.addGenerationNoticeHeader ?? false,\n });\n }\n\n write = async () => {\n if (this.persisted) {\n return;\n }\n this.persisted = true;\n\n const dir = dirname(this.filename);\n await mkdir(dir, { recursive: true });\n\n const [existingContent, fd] = await this.getExistingContent();\n this.addBlockToContent(existingContent);\n const content = await this.buildContent();\n\n if (fd) {\n await fd.write(content, 0, 'utf-8');\n await fd.close();\n } else {\n await writeFile(this.filename, content, 'utf-8');\n }\n };\n\n protected async getExistingContent() {\n try {\n const fd = await open(this.filename, 'r+');\n const existingContent = await fd.readFile('utf-8');\n return [existingContent, fd] as const;\n } catch (err) {\n return ['', null] as const;\n }\n }\n\n protected getSlices(existingContent: string) {\n const startMarkerIndex = existingContent.indexOf(this.start);\n const endMarkerIndex = existingContent.indexOf(this.end);\n\n if (startMarkerIndex === -1 || endMarkerIndex === -1) {\n return [existingContent, ''] as const;\n }\n\n return [\n existingContent.slice(0, startMarkerIndex),\n existingContent.slice(endMarkerIndex + this.end.length),\n ] as const;\n }\n\n protected addBlockToContent(existingContent: string) {\n const block = `${this.start}\\n${this.content}\\n${this.end}`;\n const padding = this.buildPadding(existingContent);\n const [startSlice, endSlice] = this.getSlices(existingContent);\n this.content = startSlice + padding + block + endSlice;\n }\n\n protected stripBlock(existingContent: string) {\n const [startSlice, endSlice] = this.getSlices(existingContent);\n return startSlice + endSlice;\n }\n\n protected buildPadding(existingContent: string) {\n const existingStripped = this.stripBlock(existingContent);\n\n if (existingStripped === '') {\n return '';\n }\n\n if (existingStripped.endsWith('\\n\\n')) {\n return '';\n }\n\n if (existingStripped.endsWith('\\n')) {\n return '\\n';\n }\n\n return '\\n\\n';\n }\n}\n","import { File, FileOptions } from './file';\n\nexport class FileManager {\n files: File[] = [];\n\n constructor(public fileOptions?: FileOptions) {}\n\n createAndAdd(filename: string, content: string, tag: string) {\n const file = new File(filename, content, tag, this.fileOptions);\n this.add(file);\n return file;\n }\n\n add(...file: File[]) {\n this.files.push(...file);\n }\n\n get(filename: string) {\n return this.files.find((file) => file.filename === filename);\n }\n\n getAll() {\n return this.files;\n }\n\n getByTag(tag: string) {\n return this.files.filter((file) => file.tag === tag);\n }\n\n remove(filename: string) {\n const index = this.files.findIndex((file) => file.filename === filename);\n this.files.splice(index, 1);\n }\n\n removeAll() {\n this.files = [];\n }\n\n removeByTag(tag: string) {\n this.files = this.files.filter((file) => file.tag !== tag);\n }\n\n writeAll() {\n const toWrite = this.files.filter((file) => !file.persisted);\n return Promise.all(toWrite.map((file) => file.write()));\n }\n\n writeByTag(tag: string) {\n const files = this.getByTag(tag);\n const toWrite = files.filter((file) => !file.persisted);\n return Promise.all(toWrite.map((file) => file.write()));\n }\n\n unlinkAll() {\n return Promise.all(this.files.map((file) => file.unlink())).then(() => {\n // void\n });\n }\n\n getPersistedFiles() {\n return this.files.filter((file) => file.persisted);\n }\n\n getPersistedFileNames() {\n return this.getPersistedFiles().map((file) => file.filename);\n }\n}\n","import { camelCase, pascalCase } from 'change-case-all';\n\nexport function getModuleGetName(name: string) {\n return `get${pascalCase(name)}Module`;\n}\n\nexport function getModuleCreateName(name: string) {\n return `create${pascalCase(name)}Module`;\n}\n\nexport function getModuleVariableName(name: string) {\n return camelCase(`${name}Module`);\n}\n","import { PluginType } from '@baeta/plugin';\nimport { NormalizedGeneratorOptions } from './config';\nimport { Ctx } from './ctx';\nimport { Watcher, WatcherFile } from './watcher';\n\nexport enum GeneratorPluginVersion {\n V1 = 'v1',\n}\n\nexport type GeneratorPluginV1Fn<Store = unknown> = (\n ctx: Ctx<Store>,\n next: () => Promise<void>,\n) => Promise<void>;\n\nexport type GeneratorPluginV1ReloadFn = (file: WatcherFile) => void;\n\nexport type GeneratorPluginV1WatchOptions = (\n options: NormalizedGeneratorOptions,\n watcher: Watcher,\n reload: GeneratorPluginV1ReloadFn,\n) => void;\n\nexport type GeneratorPluginV1Factory<Store = unknown> = {\n name: string;\n actionName: string;\n setup?: GeneratorPluginV1Fn<Store>;\n generate?: GeneratorPluginV1Fn<Store>;\n end?: GeneratorPluginV1Fn<Store>;\n watch?: GeneratorPluginV1WatchOptions;\n};\n\nexport interface GeneratorPluginV1<Store = unknown> {\n name: string;\n actionName: string;\n version: GeneratorPluginVersion.V1;\n type: PluginType.Generator;\n setup: GeneratorPluginV1Fn<Store>;\n generate: GeneratorPluginV1Fn<Store>;\n end: GeneratorPluginV1Fn<Store>;\n watch: GeneratorPluginV1WatchOptions;\n}\n\nconst defaultPluginFn: GeneratorPluginV1Fn<unknown> = async (ctx, next) => {\n return next();\n};\n\nconst defaultWatchFn = () => ({ include: [], ignore: [] });\n\nexport function createPluginV1<Store = {}>(\n options: GeneratorPluginV1Factory<Store>,\n): GeneratorPluginV1<Store> {\n return {\n name: options.name,\n actionName: options.actionName,\n version: GeneratorPluginVersion.V1,\n type: PluginType.Generator,\n end: options.end ?? defaultPluginFn,\n generate: options.generate ?? defaultPluginFn,\n setup: options.setup ?? defaultPluginFn,\n watch: options.watch ?? defaultWatchFn,\n };\n}\n\nexport function isGeneratorPlugin(plugin: {\n type: PluginType;\n}): plugin is GeneratorPluginV1<unknown> {\n return plugin.type === PluginType.Generator;\n}\n\nexport function getGeneratorPlugins(plugins?: Array<{ type: PluginType }>) {\n if (!plugins) {\n return [];\n }\n return plugins.filter(isGeneratorPlugin);\n}\n","import path, { posixPath } from '@baeta/util-path';\nimport { AsyncSubscription, Event, EventType, Options, subscribe } from '@parcel/watcher';\nimport micromatch from 'micromatch';\nimport { MatchPattern, WatcherIgnore } from './watcher-ignore';\n\nexport { micromatch };\nexport const isMatch = micromatch.isMatch;\n\nexport type WatcherListener = (path: WatcherFile) => void;\n\nexport interface WatcherFile {\n type: EventType;\n path: string;\n relativePath: string;\n}\nexport class Watcher {\n private subscription: AsyncSubscription;\n\n private listeners: Record<EventType, WatcherListener[]> = {\n create: [],\n update: [],\n delete: [],\n };\n\n private watcherIgnore: WatcherIgnore;\n\n constructor(\n private readonly cwd: string,\n private readonly options?: Options,\n ) {\n this.watcherIgnore = new WatcherIgnore(cwd);\n this.subscription = this.createSubscription();\n }\n\n onEvents = (err: Error | null, events: Event[]) => {\n if (err) {\n console.error(err);\n return;\n }\n\n const filteredEvents = events.filter((event) => {\n return !this.watcherIgnore.isIgnored(posixPath(event.path));\n });\n\n for (const event of filteredEvents) {\n for (const listener of this.listeners[event.type]) {\n listener({\n type: event.type,\n path: posixPath(event.path),\n relativePath: posixPath(path.relative(this.cwd, event.path)),\n });\n }\n }\n };\n\n on(event: EventType, listener: WatcherListener) {\n this.listeners[event].push(listener);\n }\n\n off(event: EventType, listener: WatcherListener) {\n this.listeners[event] = this.listeners[event].filter((l) => l !== listener);\n }\n\n ignore(pattern: MatchPattern) {\n this.watcherIgnore.ignore(pattern);\n }\n\n unignore(pattern: MatchPattern) {\n this.watcherIgnore.unignore(pattern);\n }\n\n createSubscription() {\n const promise = subscribe(this.cwd, this.onEvents, this.options);\n\n const unsubscribe = async () => {\n const subscription = await promise;\n await subscription.unsubscribe();\n };\n\n return {\n unsubscribe,\n };\n }\n\n close() {\n return this.subscription.unsubscribe();\n }\n}\n","import path from '@baeta/util-path';\nimport micromatch from 'micromatch';\n\nexport type MatchFn = (testString: string) => boolean;\nexport type MatchPattern = string | RegExp | MatchFn;\n\nexport class WatcherIgnore {\n private files: string[] = [];\n private regexps: RegExp[] = [];\n private functions: MatchFn[] = [];\n\n private globs: MatchFn[] = [];\n private globsMap = new Map<string, MatchFn>();\n\n constructor(private readonly cwd: string) {}\n\n ignore(pattern: MatchPattern) {\n if (pattern instanceof RegExp) {\n this.regexps.push(pattern);\n return;\n }\n\n if (typeof pattern === 'function') {\n this.functions.push(pattern);\n return;\n }\n\n if (!this.isMicromatch(pattern)) {\n this.files.push(this.resolveFile(pattern));\n return;\n }\n\n this.globsMap.set(pattern, micromatch.matcher(pattern));\n this.globs = Array.from(this.globsMap.values());\n }\n\n isMicromatch(pattern: string) {\n const result = micromatch.scan(pattern);\n return result.isBrace || result.isGlobstar || result.isExtglob || result.isGlob;\n }\n\n resolveFile(file: string) {\n return path.isAbsolute(file) ? file : path.join(this.cwd, file);\n }\n\n unignore(pattern: MatchPattern) {\n if (pattern instanceof RegExp) {\n this.regexps = this.regexps.filter((p) => p !== pattern);\n return;\n }\n\n if (typeof pattern === 'function') {\n this.functions = this.functions.filter((p) => p !== pattern);\n return;\n }\n\n if (!this.isMicromatch(pattern)) {\n const file = this.resolveFile(pattern);\n this.files = this.files.filter((p) => p !== file);\n return;\n }\n\n this.globsMap.delete(pattern);\n this.globs = Array.from(this.globsMap.values());\n }\n\n isIgnored(path: string) {\n if (this.files.includes(path)) {\n return true;\n }\n\n if (this.globs.some((f) => f(path))) {\n return true;\n }\n\n if (this.regexps.some((r) => r.test(path))) {\n return true;\n }\n\n if (this.functions.some((f) => f(path))) {\n return true;\n }\n\n return false;\n }\n}\n"],"mappings":";AAAA,SAAS,YAAY,MAAM,WAAW,UAAU,eAAe;AA6ExD,SAAS,YAAY,SAAuD;AACjF,QAAM,MAAM,UAAU,QAAQ,OAAO,QAAQ,IAAI,CAAC;AAClD,QAAM,UAAU,QAAQ,WAAW,CAAC,kBAAkB;AACtD,QAAM,aAAa,UAAU,QAAQ,KAAK,QAAQ,cAAc,aAAa,CAAC;AAC9E,QAAM,uBAAuB,QAAQ,wBAAwB;AAE7D,QAAM,uBAAuB,QAAQ,YAAY,2BAA2B;AAC5E,QAAM,gBAAgB,QAAQ,KAAK,QAAQ,i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,EACnC;AAAA,EAEA,SAAS,SAAuB;AAC9B,SAAK,cAAc,SAAS,OAAO;AAAA,EACrC;AAAA,EAEA,qBAAqB;AACnB,UAAM,UAAU,UAAU,KAAK,KAAK,KAAK,UAAU,KAAK,OAAO;AAE/D,UAAM,cAAc,YAAY;AAC9B,YAAM,eAAe,MAAM;AAC3B,YAAM,aAAa,YAAY;AAAA,IACjC;AAEA,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAAA,EAEA,QAAQ;AACN,WAAO,KAAK,aAAa,YAAY;AAAA,EACvC;AACF;","names":["dirname","dirname","GeneratorPluginVersion","path","posixPath","micromatch","path","micromatch","posixPath","path"]}
|
|
1
|
+
{"version":3,"sources":["../lib/config.ts","../lib/file.ts","../lib/file-block.ts","../lib/file-manager.ts","../lib/module.ts","../lib/plugin.ts","../lib/watcher.ts","../lib/watcher-ignore.ts"],"sourcesContent":["import { isAbsolute, join, posixPath, relative, resolve } from '@baeta/util-path';\nimport type { FileOptions } from './file.ts';\n\n/**\n * Options for the graphql generator.\n */\nexport interface GeneratorOptions {\n\t/**\n\t * Current working directory.\n\t * @default process.cwd()\n\t */\n\tcwd?: string;\n\n\t/**\n\t * Glob pattern(s) to load graphql schema files.\n\t * @default ['src/∗∗/∗.graphql']\n\t */\n\tschemas: string[];\n\n\t/**\n\t * Directory where modules are defined.\n\t * @default 'src/modules'\n\t */\n\tmodulesDir?: string;\n\n\t/**\n\t * Name for the generated module definition file. This will contain type definitions and the graphql ast.\n\t * @default 'typedef.ts'\n\t */\n\tmoduleDefinitionName?: string;\n\n\t/**\n\t * Path for the generated base types file.\n\t * @default `${modulesDir}/../__generated__/types.ts`\n\t */\n\tbaseTypesPath?: string;\n\n\t/**\n\t * Path where the context type is exported.\n\t * @example contextType: 'src/types/context#Context' // for named export\n\t * @example contextType: 'src/types/context' // for default export\n\t * @default undefined\n\t */\n\tcontextType?: string;\n\n\t/**\n\t * Path where extensions (ex. auth-extension) are exported. Only default export is supported.\n\t * @example extensions: 'src/extensions'\n\t * @default undefined\n\t */\n\textensions?: string;\n\n\t/**\n\t * Custom scalar mappings.\n\t * @example scalars: { DateTime: 'Date' }\n\t * @default undefined\n\t */\n\tscalars?: Record<string, string>;\n\n\t/**\n\t * Options for generated files.\n\t */\n\tfileOptions?: FileOptions;\n}\n\nexport interface NormalizedGeneratorOptions {\n\tcwd: string;\n\tschemas: string[];\n\tmodulesDir: string;\n\tmoduleDefinitionName: string;\n\tbaseTypesPath: string;\n\tcontextType?: string;\n\textensions?: string;\n\tscalars?: Record<string, string>;\n\tfileOptions?: FileOptions;\n}\n\nexport function loadOptions(options: GeneratorOptions): NormalizedGeneratorOptions {\n\tconst cwd = posixPath(options.cwd ?? process.cwd());\n\tconst schemas = options.schemas ?? ['src/**/*.graphql'];\n\tconst modulesDir = posixPath(resolve(cwd, options.modulesDir || 'src/modules'));\n\tconst moduleDefinitionName = options.moduleDefinitionName || 'typedef.ts';\n\n\tconst defaultBaseTypesRoot = resolve(modulesDir, '../__generated__/types.ts');\n\tconst baseTypesRoot = resolve(cwd, options.baseTypesPath || defaultBaseTypesRoot);\n\tconst baseTypesPath = posixPath(relative(modulesDir, baseTypesRoot));\n\n\tconst contextType = resolveContextType(cwd, baseTypesRoot, options.contextType);\n\tconst extensions = resolveExtensionPath(modulesDir, moduleDefinitionName, options.extensions);\n\n\treturn {\n\t\tcwd,\n\t\tschemas,\n\t\tmodulesDir,\n\t\tmoduleDefinitionName,\n\t\tbaseTypesPath,\n\t\tcontextType,\n\t\textensions,\n\t\tscalars: options.scalars,\n\t\tfileOptions: options.fileOptions,\n\t};\n}\n\nfunction resolveContextType(root: string, baseTypesRoot: string, contextType?: string) {\n\tif (!contextType) {\n\t\treturn;\n\t}\n\n\tif (isAbsolute(contextType)) {\n\t\treturn contextType;\n\t}\n\n\tif (contextType[0] === '!') {\n\t\treturn contextType.slice(1);\n\t}\n\n\tconst contextTypeRoot = resolve(root, contextType);\n\n\treturn posixPath(relative(join(baseTypesRoot, '../'), contextTypeRoot));\n}\n\nfunction resolveExtensionPath(\n\tmodulesDir: string,\n\tmoduleDefinitionName: string,\n\textensionsPath?: string,\n) {\n\tif (!extensionsPath) {\n\t\treturn;\n\t}\n\n\tif (isAbsolute(extensionsPath)) {\n\t\treturn extensionsPath;\n\t}\n\n\tif (extensionsPath[0] === '!') {\n\t\treturn extensionsPath.slice(1);\n\t}\n\n\treturn posixPath(relative(join(modulesDir, moduleDefinitionName), extensionsPath));\n}\n","import fs from 'node:fs/promises';\nimport { dirname, extname } from '@baeta/util-path';\n\n/**\n * Options for generated files.\n */\nexport interface FileOptions {\n\t/**\n\t * Add generation notice at the beginning of the file.\n\t * @default true\n\t */\n\taddGenerationNoticeHeader?: boolean;\n\n\t/**\n\t * Add eslint-disable comment at the beginning of the file.\n\t * @default true\n\t */\n\taddEslintDisableHeader?: boolean;\n\n\t/**\n\t * Add custom header at the beginning of the file.\n\t */\n\taddHeader?: (name: string, content: string, tag: string) => string;\n\n\t/**\n\t * Edit the content of the file before writing it.\n\t */\n\ttransformContent?: (name: string, content: string, tag: string) => string | Promise<string>;\n}\n\nexport class File {\n\tpersisted = false;\n\n\tconstructor(\n\t\tpublic filename: string,\n\t\tpublic content: string,\n\t\tpublic tag: string,\n\t\tprivate options?: FileOptions,\n\t) {}\n\n\twrite = async () => {\n\t\tif (this.persisted) {\n\t\t\treturn;\n\t\t}\n\t\tthis.persisted = true;\n\n\t\tconst dir = dirname(this.filename);\n\t\tawait fs.mkdir(dir, { recursive: true });\n\n\t\tconst content = await this.buildContent();\n\n\t\treturn fs.writeFile(this.filename, content, 'utf-8');\n\t};\n\n\tunlink = async () => {\n\t\tthis.persisted = false;\n\t\treturn fs.unlink(this.filename);\n\t};\n\n\tprotected async buildContent() {\n\t\tconst content = this.buildHeader() + this.content;\n\n\t\tif (this.options?.transformContent) {\n\t\t\treturn this.options.transformContent(this.filename, content, this.tag);\n\t\t}\n\n\t\treturn content;\n\t}\n\n\tprotected buildHeader() {\n\t\tconst headerItems: string[] = [];\n\n\t\tif (this.options?.addGenerationNoticeHeader !== false) {\n\t\t\tconst comment = this.createComment(\n\t\t\t\t'This file was generated by Baeta. Do not edit it directly. All changes will be overwritten by the generator.',\n\t\t\t);\n\t\t\theaderItems.push(comment);\n\t\t}\n\n\t\tif (this.options?.addEslintDisableHeader !== false) {\n\t\t\tconst comment = this.createComment('eslint-disable');\n\t\t\theaderItems.push(comment);\n\t\t}\n\n\t\tif (this.options?.addHeader) {\n\t\t\tconst customHeader = this.options.addHeader(this.filename, this.content, this.tag);\n\t\t\theaderItems.push(customHeader);\n\t\t}\n\n\t\tif (headerItems.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn `${headerItems.join('\\n')}\\n\\n`;\n\t}\n\n\tprotected createComment(comment: string) {\n\t\tconst extension = extname(this.filename);\n\n\t\tif (['.gql', '.graphql'].includes(extension)) {\n\t\t\treturn `# ${comment}`;\n\t\t}\n\n\t\treturn `/* ${comment} */`;\n\t}\n}\n","import { mkdir, open, writeFile } from 'node:fs/promises';\nimport { dirname } from '@baeta/util-path';\nimport { File, type FileOptions } from './file.ts';\n\nexport class FileBlock extends File {\n\tconstructor(\n\t\tfilename: string,\n\t\tcontent: string,\n\t\tprotected start: string,\n\t\tprotected end: string,\n\t\ttag: string,\n\t\toptions?: FileOptions,\n\t) {\n\t\tsuper(filename, content, tag, {\n\t\t\taddEslintDisableHeader: options?.addEslintDisableHeader ?? false,\n\t\t\taddGenerationNoticeHeader: options?.addGenerationNoticeHeader ?? false,\n\t\t});\n\t}\n\n\twrite = async () => {\n\t\tif (this.persisted) {\n\t\t\treturn;\n\t\t}\n\t\tthis.persisted = true;\n\n\t\tconst dir = dirname(this.filename);\n\t\tawait mkdir(dir, { recursive: true });\n\n\t\tconst [existingContent, fd] = await this.getExistingContent();\n\t\tthis.addBlockToContent(existingContent);\n\t\tconst content = await this.buildContent();\n\n\t\tif (fd) {\n\t\t\tawait fd.write(content, 0, 'utf-8');\n\t\t\tawait fd.close();\n\t\t} else {\n\t\t\tawait writeFile(this.filename, content, 'utf-8');\n\t\t}\n\t};\n\n\tprotected async getExistingContent() {\n\t\ttry {\n\t\t\tconst fd = await open(this.filename, 'r+');\n\t\t\tconst existingContent = await fd.readFile('utf-8');\n\t\t\treturn [existingContent, fd] as const;\n\t\t} catch (err) {\n\t\t\treturn ['', null] as const;\n\t\t}\n\t}\n\n\tprotected getSlices(existingContent: string) {\n\t\tconst startMarkerIndex = existingContent.indexOf(this.start);\n\t\tconst endMarkerIndex = existingContent.indexOf(this.end);\n\n\t\tif (startMarkerIndex === -1 || endMarkerIndex === -1) {\n\t\t\treturn [existingContent, ''] as const;\n\t\t}\n\n\t\treturn [\n\t\t\texistingContent.slice(0, startMarkerIndex),\n\t\t\texistingContent.slice(endMarkerIndex + this.end.length),\n\t\t] as const;\n\t}\n\n\tprotected addBlockToContent(existingContent: string) {\n\t\tconst block = `${this.start}\\n${this.content}\\n${this.end}`;\n\t\tconst padding = this.buildPadding(existingContent);\n\t\tconst [startSlice, endSlice] = this.getSlices(existingContent);\n\t\tthis.content = startSlice + padding + block + endSlice;\n\t}\n\n\tprotected stripBlock(existingContent: string) {\n\t\tconst [startSlice, endSlice] = this.getSlices(existingContent);\n\t\treturn startSlice + endSlice;\n\t}\n\n\tprotected buildPadding(existingContent: string) {\n\t\tconst existingStripped = this.stripBlock(existingContent);\n\n\t\tif (existingStripped === '') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (existingStripped.endsWith('\\n\\n')) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (existingStripped.endsWith('\\n')) {\n\t\t\treturn '\\n';\n\t\t}\n\n\t\treturn '\\n\\n';\n\t}\n}\n","import { File, type FileOptions } from './file.ts';\n\nexport class FileManager {\n\tfiles: File[] = [];\n\n\tconstructor(public fileOptions?: FileOptions) {}\n\n\tcreateAndAdd(filename: string, content: string, tag: string) {\n\t\tconst file = new File(filename, content, tag, this.fileOptions);\n\t\tthis.add(file);\n\t\treturn file;\n\t}\n\n\tadd(...file: File[]) {\n\t\tthis.files.push(...file);\n\t}\n\n\tget(filename: string) {\n\t\treturn this.files.find((file) => file.filename === filename);\n\t}\n\n\tgetAll() {\n\t\treturn this.files;\n\t}\n\n\tgetByTag(tag: string) {\n\t\treturn this.files.filter((file) => file.tag === tag);\n\t}\n\n\tremove(filename: string) {\n\t\tconst index = this.files.findIndex((file) => file.filename === filename);\n\t\tthis.files.splice(index, 1);\n\t}\n\n\tremoveAll() {\n\t\tthis.files = [];\n\t}\n\n\tremoveByTag(tag: string) {\n\t\tthis.files = this.files.filter((file) => file.tag !== tag);\n\t}\n\n\twriteAll() {\n\t\tconst toWrite = this.files.filter((file) => !file.persisted);\n\t\treturn Promise.all(toWrite.map((file) => file.write()));\n\t}\n\n\twriteByTag(tag: string) {\n\t\tconst files = this.getByTag(tag);\n\t\tconst toWrite = files.filter((file) => !file.persisted);\n\t\treturn Promise.all(toWrite.map((file) => file.write()));\n\t}\n\n\tunlinkAll() {\n\t\treturn Promise.all(this.files.map((file) => file.unlink())).then(() => {\n\t\t\t// void\n\t\t});\n\t}\n\n\tgetPersistedFiles() {\n\t\treturn this.files.filter((file) => file.persisted);\n\t}\n\n\tgetPersistedFileNames() {\n\t\treturn this.getPersistedFiles().map((file) => file.filename);\n\t}\n}\n","import { camelCase, pascalCase } from 'change-case-all';\n\nexport function getModuleGetName(name: string) {\n\treturn `get${pascalCase(name)}Module`;\n}\n\nexport function getModuleCreateName(name: string) {\n\treturn `create${pascalCase(name)}Module`;\n}\n\nexport function getModuleVariableName(name: string) {\n\treturn camelCase(`${name}Module`);\n}\n","import { PluginType } from '@baeta/plugin';\nimport type { NormalizedGeneratorOptions } from './config.ts';\nimport type { Ctx } from './ctx.ts';\nimport type { Watcher, WatcherFile } from './watcher.ts';\n\nexport enum GeneratorPluginVersion {\n\tV1 = 'v1',\n}\n\nexport type GeneratorPluginV1Fn<Store = unknown> = (\n\tctx: Ctx<Store>,\n\tnext: () => Promise<void>,\n) => Promise<void>;\n\nexport type GeneratorPluginV1ReloadFn = (file: WatcherFile) => void;\n\nexport type GeneratorPluginV1WatchOptions = (\n\toptions: NormalizedGeneratorOptions,\n\twatcher: Watcher,\n\treload: GeneratorPluginV1ReloadFn,\n) => void;\n\nexport type GeneratorPluginV1Factory<Store = unknown> = {\n\tname: string;\n\tactionName: string;\n\tsetup?: GeneratorPluginV1Fn<Store>;\n\tgenerate?: GeneratorPluginV1Fn<Store>;\n\tend?: GeneratorPluginV1Fn<Store>;\n\twatch?: GeneratorPluginV1WatchOptions;\n};\n\nexport interface GeneratorPluginV1<Store = unknown> {\n\tname: string;\n\tactionName: string;\n\tversion: GeneratorPluginVersion.V1;\n\ttype: PluginType.Generator;\n\tsetup: GeneratorPluginV1Fn<Store>;\n\tgenerate: GeneratorPluginV1Fn<Store>;\n\tend: GeneratorPluginV1Fn<Store>;\n\twatch: GeneratorPluginV1WatchOptions;\n}\n\nconst defaultPluginFn: GeneratorPluginV1Fn<unknown> = async (ctx, next) => {\n\treturn next();\n};\n\nconst defaultWatchFn = () => ({ include: [], ignore: [] });\n\nexport function createPluginV1<Store = {}>(\n\toptions: GeneratorPluginV1Factory<Store>,\n): GeneratorPluginV1<Store> {\n\treturn {\n\t\tname: options.name,\n\t\tactionName: options.actionName,\n\t\tversion: GeneratorPluginVersion.V1,\n\t\ttype: PluginType.Generator,\n\t\tend: options.end ?? defaultPluginFn,\n\t\tgenerate: options.generate ?? defaultPluginFn,\n\t\tsetup: options.setup ?? defaultPluginFn,\n\t\twatch: options.watch ?? defaultWatchFn,\n\t};\n}\n\nexport function isGeneratorPlugin(plugin: {\n\ttype: PluginType;\n}): plugin is GeneratorPluginV1<unknown> {\n\treturn plugin.type === PluginType.Generator;\n}\n\nexport function getGeneratorPlugins(plugins?: Array<{ type: PluginType }>) {\n\tif (!plugins) {\n\t\treturn [];\n\t}\n\treturn plugins.filter(isGeneratorPlugin);\n}\n","import path, { posixPath } from '@baeta/util-path';\nimport {\n\ttype AsyncSubscription,\n\ttype Event,\n\ttype EventType,\n\ttype Options,\n\tsubscribe,\n} from '@parcel/watcher';\nimport micromatch from 'micromatch';\nimport { type MatchPattern, WatcherIgnore } from './watcher-ignore.ts';\n\nexport { micromatch };\nexport const isMatch = micromatch.isMatch;\n\nexport type WatcherListener = (path: WatcherFile) => void;\n\nexport interface WatcherFile {\n\ttype: EventType;\n\tpath: string;\n\trelativePath: string;\n}\nexport class Watcher {\n\tprivate subscription: AsyncSubscription;\n\n\tprivate listeners: Record<EventType, WatcherListener[]> = {\n\t\tcreate: [],\n\t\tupdate: [],\n\t\tdelete: [],\n\t};\n\n\tprivate watcherIgnore: WatcherIgnore;\n\n\tconstructor(\n\t\tprivate readonly cwd: string,\n\t\tprivate readonly options?: Options,\n\t) {\n\t\tthis.watcherIgnore = new WatcherIgnore(cwd);\n\t\tthis.subscription = this.createSubscription();\n\t}\n\n\tonEvents = (err: Error | null, events: Event[]) => {\n\t\tif (err) {\n\t\t\tconsole.error(err);\n\t\t\treturn;\n\t\t}\n\n\t\tconst filteredEvents = events.filter((event) => {\n\t\t\treturn !this.watcherIgnore.isIgnored(posixPath(event.path));\n\t\t});\n\n\t\tfor (const event of filteredEvents) {\n\t\t\tfor (const listener of this.listeners[event.type]) {\n\t\t\t\tlistener({\n\t\t\t\t\ttype: event.type,\n\t\t\t\t\tpath: posixPath(event.path),\n\t\t\t\t\trelativePath: posixPath(path.relative(this.cwd, event.path)),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n\ton(event: EventType, listener: WatcherListener) {\n\t\tthis.listeners[event].push(listener);\n\t}\n\n\toff(event: EventType, listener: WatcherListener) {\n\t\tthis.listeners[event] = this.listeners[event].filter((l) => l !== listener);\n\t}\n\n\tignore(pattern: MatchPattern) {\n\t\tthis.watcherIgnore.ignore(pattern);\n\t}\n\n\tunignore(pattern: MatchPattern) {\n\t\tthis.watcherIgnore.unignore(pattern);\n\t}\n\n\tcreateSubscription() {\n\t\tconst promise = subscribe(this.cwd, this.onEvents, this.options);\n\n\t\tconst unsubscribe = async () => {\n\t\t\tconst subscription = await promise;\n\t\t\tawait subscription.unsubscribe();\n\t\t};\n\n\t\treturn {\n\t\t\tunsubscribe,\n\t\t};\n\t}\n\n\tclose() {\n\t\treturn this.subscription.unsubscribe();\n\t}\n}\n","import path from '@baeta/util-path';\nimport micromatch from 'micromatch';\n\nexport type MatchFn = (testString: string) => boolean;\nexport type MatchPattern = string | RegExp | MatchFn;\n\nexport class WatcherIgnore {\n\tprivate files: string[] = [];\n\tprivate regexps: RegExp[] = [];\n\tprivate functions: MatchFn[] = [];\n\n\tprivate globs: MatchFn[] = [];\n\tprivate globsMap = new Map<string, MatchFn>();\n\n\tconstructor(private readonly cwd: string) {}\n\n\tignore(pattern: MatchPattern) {\n\t\tif (pattern instanceof RegExp) {\n\t\t\tthis.regexps.push(pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof pattern === 'function') {\n\t\t\tthis.functions.push(pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.isMicromatch(pattern)) {\n\t\t\tthis.files.push(this.resolveFile(pattern));\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globsMap.set(pattern, micromatch.matcher(pattern));\n\t\tthis.globs = Array.from(this.globsMap.values());\n\t}\n\n\tisMicromatch(pattern: string) {\n\t\tconst result = micromatch.scan(pattern);\n\t\treturn result.isBrace || result.isGlobstar || result.isExtglob || result.isGlob;\n\t}\n\n\tresolveFile(file: string) {\n\t\treturn path.isAbsolute(file) ? file : path.join(this.cwd, file);\n\t}\n\n\tunignore(pattern: MatchPattern) {\n\t\tif (pattern instanceof RegExp) {\n\t\t\tthis.regexps = this.regexps.filter((p) => p !== pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof pattern === 'function') {\n\t\t\tthis.functions = this.functions.filter((p) => p !== pattern);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.isMicromatch(pattern)) {\n\t\t\tconst file = this.resolveFile(pattern);\n\t\t\tthis.files = this.files.filter((p) => p !== file);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globsMap.delete(pattern);\n\t\tthis.globs = Array.from(this.globsMap.values());\n\t}\n\n\tisIgnored(path: string) {\n\t\tif (this.files.includes(path)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.globs.some((f) => f(path))) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.regexps.some((r) => r.test(path))) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.functions.some((f) => f(path))) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"],"mappings":";AAAA,SAAS,YAAY,MAAM,WAAW,UAAU,eAAe;AA6ExD,SAAS,YAAY,SAAuD;AAClF,QAAM,MAAM,UAAU,QAAQ,OAAO,QAAQ,IAAI,CAAC;AAClD,QAAM,UAAU,QAAQ,WAAW,CAAC,kBAAkB;AACtD,QAAM,aAAa,UAAU,QAAQ,KAAK,QAAQ,cAAc,aAAa,CAAC;AAC9E,QAAM,uBAAuB,QAAQ,wBAAwB;AAE7D,QAAM,uBAAuB,QAAQ,YAAY,2BAA2B;AAC5E,QAAM,gBAAgB,QAAQ,KAAK,QAAQ,iBAAiB,oBAAoB;AAChF,QAAM,gBAAgB,UAAU,SAAS,YAAY,aAAa,CAAC;AAEnE,QAAM,cAAc,mBAAmB,KAAK,eAAe,QAAQ,WAAW;AAC9E,QAAM,aAAa,qBAAqB,YAAY,sBAAsB,QAAQ,UAAU;AAE5F,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,QAAQ;AAAA,IACjB,aAAa,QAAQ;AAAA,EACtB;AACD;AAEA,SAAS,mBAAmB,MAAc,eAAuB,aAAsB;AACtF,MAAI,CAAC,aAAa;AACjB;AAAA,EACD;AAEA,MAAI,WAAW,WAAW,GAAG;AAC5B,WAAO;AAAA,EACR;AAEA,MAAI,YAAY,CAAC,MA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,WAAoB;AAClD,QAAI,KAAK;AACR,cAAQ,MAAM,GAAG;AACjB;AAAA,IACD;AAEA,UAAM,iBAAiB,OAAO,OAAO,CAAC,UAAU;AAC/C,aAAO,CAAC,KAAK,cAAc,UAAUC,WAAU,MAAM,IAAI,CAAC;AAAA,IAC3D,CAAC;AAED,eAAW,SAAS,gBAAgB;AACnC,iBAAW,YAAY,KAAK,UAAU,MAAM,IAAI,GAAG;AAClD,iBAAS;AAAA,UACR,MAAM,MAAM;AAAA,UACZ,MAAMA,WAAU,MAAM,IAAI;AAAA,UAC1B,cAAcA,WAAUC,MAAK,SAAS,KAAK,KAAK,MAAM,IAAI,CAAC;AAAA,QAC5D,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,GAAG,OAAkB,UAA2B;AAC/C,SAAK,UAAU,KAAK,EAAE,KAAK,QAAQ;AAAA,EACpC;AAAA,EAEA,IAAI,OAAkB,UAA2B;AAChD,SAAK,UAAU,KAAK,IAAI,KAAK,UAAU,KAAK,EAAE,OAAO,CAAC,MAAM,MAAM,QAAQ;AAAA,EAC3E;AAAA,EAEA,OAAO,SAAuB;AAC7B,SAAK,cAAc,OAAO,OAAO;AAAA,EAClC;AAAA,EAEA,SAAS,SAAuB;AAC/B,SAAK,cAAc,SAAS,OAAO;AAAA,EACpC;AAAA,EAEA,qBAAqB;AACpB,UAAM,UAAU,UAAU,KAAK,KAAK,KAAK,UAAU,KAAK,OAAO;AAE/D,UAAM,cAAc,YAAY;AAC/B,YAAM,eAAe,MAAM;AAC3B,YAAM,aAAa,YAAY;AAAA,IAChC;AAEA,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AAAA,EAEA,QAAQ;AACP,WAAO,KAAK,aAAa,YAAY;AAAA,EACtC;AACD;","names":["dirname","dirname","GeneratorPluginVersion","path","posixPath","micromatch","path","micromatch","posixPath","path"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/generator-sdk",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"baeta",
|
|
6
6
|
"graphql",
|
|
@@ -44,23 +44,32 @@
|
|
|
44
44
|
"types": "tsc --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@baeta/plugin": "^0.0
|
|
48
|
-
"@baeta/util-path": "^0.0
|
|
47
|
+
"@baeta/plugin": "^0.1.0",
|
|
48
|
+
"@baeta/util-path": "^0.1.0",
|
|
49
49
|
"@parcel/watcher": "^2.4.1",
|
|
50
50
|
"change-case-all": "2.1.0",
|
|
51
|
-
"micromatch": "^4.0.
|
|
51
|
+
"micromatch": "^4.0.8"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@baeta/builder": "^0.0.0",
|
|
55
55
|
"@baeta/tsconfig": "^0.0.0",
|
|
56
56
|
"@types/micromatch": "^4.0.9",
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"typescript": "^5.
|
|
57
|
+
"@types/node": "^22.7.4",
|
|
58
|
+
"typescript": "^5.6.2"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
|
-
"node": ">=
|
|
61
|
+
"node": ">=22.0.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"ava": {
|
|
67
|
+
"extensions": {
|
|
68
|
+
"ts": "module"
|
|
69
|
+
},
|
|
70
|
+
"nodeArguments": [
|
|
71
|
+
"--no-warnings",
|
|
72
|
+
"--experimental-transform-types"
|
|
73
|
+
]
|
|
65
74
|
}
|
|
66
75
|
}
|