@gtkx/config 1.0.0-rc.4 → 1.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.
Files changed (46) hide show
  1. package/README.md +5 -5
  2. package/dist/config-error.d.ts +2 -1
  3. package/dist/config-error.d.ts.map +1 -1
  4. package/dist/config-error.js +16 -4
  5. package/dist/config-error.js.map +1 -1
  6. package/dist/config.d.ts +239 -5
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +6 -33
  9. package/dist/config.js.map +1 -1
  10. package/dist/deploy.d.ts +237 -0
  11. package/dist/deploy.d.ts.map +1 -0
  12. package/dist/deploy.js +232 -0
  13. package/dist/deploy.js.map +1 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/internal.d.ts +2 -2
  18. package/dist/internal.d.ts.map +1 -1
  19. package/dist/internal.js +1 -1
  20. package/dist/internal.js.map +1 -1
  21. package/dist/loader.d.ts +6 -3
  22. package/dist/loader.d.ts.map +1 -1
  23. package/dist/loader.js +10 -8
  24. package/dist/loader.js.map +1 -1
  25. package/dist/schema-text.d.ts +10 -0
  26. package/dist/schema-text.d.ts.map +1 -0
  27. package/dist/schema-text.js +19 -0
  28. package/dist/schema-text.js.map +1 -0
  29. package/dist/user-event-signals.d.ts +1 -2
  30. package/dist/user-event-signals.d.ts.map +1 -1
  31. package/dist/user-event-signals.js +1 -7
  32. package/dist/user-event-signals.js.map +1 -1
  33. package/dist/vite-plugin.d.ts +8 -1
  34. package/dist/vite-plugin.d.ts.map +1 -1
  35. package/dist/vite-plugin.js +5 -1
  36. package/dist/vite-plugin.js.map +1 -1
  37. package/package.json +13 -3
  38. package/src/config-error.ts +23 -4
  39. package/src/config.ts +6 -36
  40. package/src/deploy.ts +260 -0
  41. package/src/index.ts +1 -1
  42. package/src/internal.ts +2 -1
  43. package/src/loader.ts +16 -9
  44. package/src/schema-text.ts +38 -0
  45. package/src/user-event-signals.ts +1 -7
  46. package/src/vite-plugin.ts +11 -2
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAiDlE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAC5E,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,CAAU,CAAC;AAC5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACrE,MAAM,mBAAmB,GAAgB,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAEnE,gHAAgH;AAChH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAwC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAExB,IAAI,KAAK,KAAK,kBAAkB,EAAE,CAAC;QAC/B,OAAO;IACX,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC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vF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,mBAAmB,GAAG,CAAC,QAA4B,EAA4B,EAAE,CACnF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IACtE,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,aAAa,EAAE,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC;IAChE,gBAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC;IACjE,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC;CACrD,CAAC,CAAC;AAEH,OAAO,EACH,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GAKhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord, rawIssue } from \"./config-error.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Accepted `reactCompiler.compilationMode` values, choosing which functions the compiler processes. */\ntype ReactCompilerCompilationMode = (typeof COMPILATION_MODES)[number];\n/** Accepted `reactCompiler.panicThreshold` values, choosing which compiler diagnostics fail the build. */\ntype ReactCompilerPanicThreshold = (typeof PANIC_THRESHOLDS)[number];\n\n/** Object form of the `reactCompiler` config key, forwarded as-is to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes; left to the compiler's own default when omitted. */\n compilationMode?: ReactCompilerCompilationMode;\n /** Which compiler diagnostics fail the build; left to the compiler's own default when omitted. */\n panicThreshold?: ReactCompilerPanicThreshold;\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, and the React\n * Compiler, codegen, and user event signal settings.\n */\ntype Config = z.infer<typeof configSchema>;\n/** A named export referenced as plain data, so codegen can emit an import for it without loading the module. */\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\n/** One `elements.config` entry, describing how a single GLib type's generated element is shaped. */\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /** Signal names, keyed by GLib type name, that stay suppressed while a React commit runs. */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst LIBRARIES_WILDCARD = \"*\";\nconst GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\nconst COMPILATION_MODE_SET: Set<string> = new Set(COMPILATION_MODES);\nconst PANIC_THRESHOLD_SET: Set<string> = new Set(PANIC_THRESHOLDS);\n\n/** Validates `libraries`: the `\"*\"` wildcard on its own, or a non-empty array of `Name-Version` identifiers. */\nconst librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((ctx) => {\n const value = ctx.value;\n\n if (value === LIBRARIES_WILDCARD) {\n return;\n }\n\n if (!Array.isArray(value) || value.length === 0) {\n ctx.issues.push(rawIssue(value, [], `must be \"${LIBRARIES_WILDCARD}\", a non-empty string array, or omitted`));\n\n return;\n }\n\n for (const [index, entry] of value.entries()) {\n ctx.issues.push(...libraryEntryIssues(value, index, entry));\n }\n});\n\n/** Validates `applicationId` against the reverse-DNS form `g_application_id_is_valid` accepts. */\nconst applicationIdSchema = z.custom<string>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value !== \"string\" || !isValidApplicationId(value)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`applicationId\\` \"${value}\", must satisfy g_application_id_is_valid ` +\n '(e.g. \"org.example.MyApp\")',\n true,\n ),\n );\n }\n});\n\n/** Validates `reactCompiler`: a boolean, or an options object whose mode and threshold are known values. */\nconst reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value === \"boolean\") {\n return;\n }\n\n if (!isRecord(value)) {\n ctx.issues.push(rawIssue(value, [], \"must be a boolean or an options object\"));\n\n return;\n }\n\n const compilationMode = value.compilationMode;\n\n if (!isValidReactCompilerOption(compilationMode, COMPILATION_MODE_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.compilationMode\\` \"${String(compilationMode)}\", ` +\n `must be one of ${COMPILATION_MODES.join(\", \")}`,\n true,\n ),\n );\n }\n\n const panicThreshold = value.panicThreshold;\n\n if (!isValidReactCompilerOption(panicThreshold, PANIC_THRESHOLD_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.panicThreshold\\` \"${String(panicThreshold)}\", ` +\n `must be one of ${PANIC_THRESHOLDS.join(\", \")}`,\n true,\n ),\n );\n }\n});\n\n/** Validates `userEventSignals`: GLib type names mapped to arrays of non-empty signal names. */\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\n/** Validates a `{ module, export }` reference to a named export. */\nconst moduleExportSchema = z.object(\n {\n /** Specifier the export is imported from. */\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n /** Identifier the module exports it under. */\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\n/** Validates one entry of `elements.config`. */\nconst elementConfigSchema = z.object({\n /** Component that wraps the generated element. */\n component: moduleExportSchema.optional(),\n /** Base props interface the generated element props extend. */\n props: moduleExportSchema.optional(),\n /** Marks the element as having no GObject of its own, its parent container creating one instead. */\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n /** GObject properties to leave out of the generated element props, such as those a behavior fills. */\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\n/** Validates `elements`: the behaviors module the app loads at runtime, plus the per-type entries. */\nconst elementsSchema = z.object({\n /**\n * Path, resolved against the project root, of a module default-exporting element configs keyed by\n * GLib type name, as `defineElements` returns.\n */\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n /** Per-element entries, keyed by GLib type name. */\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\n/** The shape every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n /**\n * GIR namespaces to bind as `Name-Version`, or `\"*\"` for every one installed; omitting it gives\n * `Gtk-4.0`, which is also prepended to any list that names no Gtk version of its own.\n */\n libraries: librariesSchema.optional(),\n /** Directories searched for `.gir` files ahead of `GTKX_GIR_PATH` and the system locations. */\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n /** Reverse-DNS GApplication identifier, and the default `applicationId` of the application element. */\n applicationId: applicationIdSchema,\n /** React Compiler settings; the compiler runs unless this is `false`. */\n reactCompiler: reactCompilerSchema.optional(),\n /** Whether to generate the binding stores; `false` makes the CLI resolve an already-installed one. */\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit applies props, so\n * their handlers only ever report user interaction. Unioned with the built-in GTK4 and Adwaita table.\n */\n userEventSignals: userEventSignalsSchema.optional(),\n /** Per-element customization: where the behaviors module lives and how each type's element is shaped. */\n elements: elementsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\n\nconst libraryEntryIssues = (value: unknown[], index: number, entry: unknown): ReturnType<typeof rawIssue>[] => {\n if (typeof entry === \"string\" && GIR_LIBRARY_PATTERN.test(entry)) {\n return [];\n }\n\n if (entry === LIBRARIES_WILDCARD) {\n const message =\n `to generate every library, set \\`libraries: \"${LIBRARIES_WILDCARD}\"\\` as a bare string, ` +\n \"not an array entry\";\n\n return [rawIssue(value, [index], message, true)];\n }\n\n const message =\n `invalid library identifier \"${String(entry)}\", must be of the form \"Name-Version\" ` +\n '(e.g. \"Gtk-4.0\")';\n\n return [rawIssue(value, [index], message, true)];\n};\n\nconst isValidApplicationId = (applicationId: string): boolean => {\n if (applicationId.length === 0 || applicationId.length > APPLICATION_ID_MAX_LENGTH) {\n return false;\n }\n\n return APPLICATION_ID_PATTERN.test(applicationId);\n};\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return { ...overrides, target: REACT_COMPILER_TARGET };\n};\n\nconst isValidReactCompilerOption = (value: unknown, allowed: Set<string>): boolean =>\n value === undefined || (typeof value === \"string\" && allowed.has(value));\n\nconst validateConfig = (config: Config): void => {\n const result = configSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\n/**\n * Deep-merges two configurations. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n defineConfig,\n isValidApplicationId,\n resolveReactCompilerOptions,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveOmittedProps,\n resolveConfig,\n type ResolvedReactCompilerOptions,\n type Config,\n type ModuleExport,\n type ResolvedConfig,\n};\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AA+ClE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,+DAA+D;AAC/D,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAC5E,8DAA8D;AAC9D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,CAAU,CAAC;AAC5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACrE,MAAM,mBAAmB,GAAgB,IAAI,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G,CAAC,QAA4B,EAAgC,EAAE,CACvF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,mBAAmB,GAAG,CAAC,QAA4B,EAA4B,EAAE,CACnF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IACtE,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,aAAa,EAAE,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC;IAChE,gBAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC;IACjE,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC;CACrD,CAAC,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GAIhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord, rawIssue } from \"./config-error.ts\";\nimport { deploySchema } from \"./deploy.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Accepted `reactCompiler.compilationMode` values, choosing which functions the compiler processes. */\ntype ReactCompilerCompilationMode = (typeof COMPILATION_MODES)[number];\n/** Accepted `reactCompiler.panicThreshold` values, choosing which compiler diagnostics fail the build. */\ntype ReactCompilerPanicThreshold = (typeof PANIC_THRESHOLDS)[number];\n\n/** Object form of the `reactCompiler` config key, forwarded as-is to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes; left to the compiler's own default when omitted. */\n compilationMode?: ReactCompilerCompilationMode;\n /** Which compiler diagnostics fail the build; left to the compiler's own default when omitted. */\n panicThreshold?: ReactCompilerPanicThreshold;\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, and the React\n * Compiler, codegen, and user event signal settings.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /** Signal names, keyed by GLib type name, that stay suppressed while a React commit runs. */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst LIBRARIES_WILDCARD = \"*\";\nconst GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\nconst COMPILATION_MODE_SET: Set<string> = new Set(COMPILATION_MODES);\nconst PANIC_THRESHOLD_SET: Set<string> = new Set(PANIC_THRESHOLDS);\n\nconst librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((ctx) => {\n const value = ctx.value;\n\n if (value === LIBRARIES_WILDCARD) {\n return;\n }\n\n if (!Array.isArray(value) || value.length === 0) {\n ctx.issues.push(rawIssue(value, [], `must be \"${LIBRARIES_WILDCARD}\", a non-empty string array, or omitted`));\n\n return;\n }\n\n for (const [index, entry] of value.entries()) {\n ctx.issues.push(...libraryEntryIssues(value, index, entry));\n }\n});\n\nconst applicationIdSchema = z.custom<string>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value !== \"string\" || !isValidApplicationId(value)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`applicationId\\` \"${value}\", must satisfy g_application_id_is_valid ` +\n '(e.g. \"org.example.MyApp\")',\n true,\n ),\n );\n }\n});\n\nconst reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value === \"boolean\") {\n return;\n }\n\n if (!isRecord(value)) {\n ctx.issues.push(rawIssue(value, [], \"must be a boolean or an options object\"));\n\n return;\n }\n\n const compilationMode = value.compilationMode;\n\n if (!isValidReactCompilerOption(compilationMode, COMPILATION_MODE_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.compilationMode\\` \"${String(compilationMode)}\", ` +\n `must be one of ${COMPILATION_MODES.join(\", \")}`,\n true,\n ),\n );\n }\n\n const panicThreshold = value.panicThreshold;\n\n if (!isValidReactCompilerOption(panicThreshold, PANIC_THRESHOLD_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.panicThreshold\\` \"${String(panicThreshold)}\", ` +\n `must be one of ${PANIC_THRESHOLDS.join(\", \")}`,\n true,\n ),\n );\n }\n});\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.object(\n {\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\nconst elementConfigSchema = z.object({\n component: moduleExportSchema.optional(),\n props: moduleExportSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\nconst elementsSchema = z.object({\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n libraries: librariesSchema.optional(),\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n applicationId: applicationIdSchema,\n reactCompiler: reactCompilerSchema.optional(),\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n userEventSignals: userEventSignalsSchema.optional(),\n elements: elementsSchema.optional(),\n deploy: deploySchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\n\nconst libraryEntryIssues = (value: unknown[], index: number, entry: unknown): ReturnType<typeof rawIssue>[] => {\n if (typeof entry === \"string\" && GIR_LIBRARY_PATTERN.test(entry)) {\n return [];\n }\n\n if (entry === LIBRARIES_WILDCARD) {\n const message =\n `to generate every library, set \\`libraries: \"${LIBRARIES_WILDCARD}\"\\` as a bare string, ` +\n \"not an array entry\";\n\n return [rawIssue(value, [index], message, true)];\n }\n\n const message =\n `invalid library identifier \"${String(entry)}\", must be of the form \"Name-Version\" ` +\n '(e.g. \"Gtk-4.0\")';\n\n return [rawIssue(value, [index], message, true)];\n};\n\nconst isValidApplicationId = (applicationId: string): boolean => {\n if (applicationId.length === 0 || applicationId.length > APPLICATION_ID_MAX_LENGTH) {\n return false;\n }\n\n return APPLICATION_ID_PATTERN.test(applicationId);\n};\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return { ...overrides, target: REACT_COMPILER_TARGET };\n};\n\nconst isValidReactCompilerOption = (value: unknown, allowed: Set<string>): boolean =>\n value === undefined || (typeof value === \"string\" && allowed.has(value));\n\nconst validateConfig = (config: Config): void => {\n const result = configSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\n/**\n * Deep-merges two configurations. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n APPLICATION_ID_MAX_LENGTH,\n defineConfig,\n isValidApplicationId,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveOmittedProps,\n resolveConfig,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}
@@ -0,0 +1,237 @@
1
+ import { z } from "zod";
2
+ declare const deploySchema: z.ZodObject<{
3
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
4
+ appimage: "appimage";
5
+ deb: "deb";
6
+ flatpak: "flatpak";
7
+ rpm: "rpm";
8
+ }>>>;
9
+ outDir: z.ZodOptional<z.ZodString>;
10
+ name: z.ZodOptional<z.ZodString>;
11
+ genericName: z.ZodOptional<z.ZodString>;
12
+ binaryName: z.ZodOptional<z.ZodString>;
13
+ version: z.ZodOptional<z.ZodString>;
14
+ release: z.ZodOptional<z.ZodString>;
15
+ epoch: z.ZodOptional<z.ZodInt>;
16
+ summary: z.ZodOptional<z.ZodString>;
17
+ description: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
+ developer: z.ZodOptional<z.ZodObject<{
22
+ id: z.ZodOptional<z.ZodString>;
23
+ name: z.ZodOptional<z.ZodString>;
24
+ email: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strict>>;
26
+ license: z.ZodOptional<z.ZodString>;
27
+ licenseFile: z.ZodOptional<z.ZodString>;
28
+ metadataLicense: z.ZodOptional<z.ZodString>;
29
+ copyright: z.ZodOptional<z.ZodString>;
30
+ homepage: z.ZodOptional<z.ZodURL>;
31
+ urls: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
32
+ bugtracker: "bugtracker";
33
+ contact: "contact";
34
+ contribute: "contribute";
35
+ donation: "donation";
36
+ faq: "faq";
37
+ help: "help";
38
+ translate: "translate";
39
+ "vcs-browser": "vcs-browser";
40
+ }> & z.core.$partial, z.ZodURL>>;
41
+ icons: z.ZodOptional<z.ZodString>;
42
+ screenshots: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
+ url: z.ZodOptional<z.ZodURL>;
44
+ file: z.ZodOptional<z.ZodString>;
45
+ caption: z.ZodOptional<z.ZodString>;
46
+ isDefault: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strict>>>;
48
+ screenshotBaseUrl: z.ZodOptional<z.ZodURL>;
49
+ branding: z.ZodOptional<z.ZodObject<{
50
+ light: z.ZodString;
51
+ dark: z.ZodString;
52
+ }, z.core.$strict>>;
53
+ contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
54
+ none: "none";
55
+ intense: "intense";
56
+ mild: "mild";
57
+ moderate: "moderate";
58
+ }>>>;
59
+ releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
60
+ version: z.ZodString;
61
+ date: z.ZodISODate;
62
+ type: z.ZodOptional<z.ZodEnum<{
63
+ development: "development";
64
+ snapshot: "snapshot";
65
+ stable: "stable";
66
+ }>>;
67
+ urgency: z.ZodOptional<z.ZodEnum<{
68
+ critical: "critical";
69
+ high: "high";
70
+ low: "low";
71
+ medium: "medium";
72
+ }>>;
73
+ notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
74
+ url: z.ZodOptional<z.ZodURL>;
75
+ }, z.core.$strict>>>;
76
+ execArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
+ fileAssociations: z.ZodOptional<z.ZodArray<z.ZodObject<{
78
+ extension: z.ZodString;
79
+ mimeType: z.ZodString;
80
+ description: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strict>>>;
82
+ protocols: z.ZodOptional<z.ZodArray<z.ZodString>>;
83
+ desktopActions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
84
+ name: z.ZodString;
85
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ icon: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strict>>>;
88
+ desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
89
+ isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
90
+ extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
91
+ depends: z.ZodOptional<z.ZodObject<{
92
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ }, z.core.$strict>>;
95
+ relations: z.ZodOptional<z.ZodObject<{
96
+ recommends: z.ZodOptional<z.ZodObject<{
97
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
+ }, z.core.$strict>>;
100
+ suggests: z.ZodOptional<z.ZodObject<{
101
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
103
+ }, z.core.$strict>>;
104
+ provides: z.ZodOptional<z.ZodObject<{
105
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ }, z.core.$strict>>;
108
+ conflicts: z.ZodOptional<z.ZodObject<{
109
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
+ }, z.core.$strict>>;
112
+ replaces: z.ZodOptional<z.ZodObject<{
113
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
+ }, z.core.$strict>>;
116
+ breaks: z.ZodOptional<z.ZodObject<{
117
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
+ }, z.core.$strict>>;
120
+ preDepends: z.ZodOptional<z.ZodObject<{
121
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
+ }, z.core.$strict>>;
124
+ }, z.core.$strict>>;
125
+ scripts: z.ZodOptional<z.ZodObject<{
126
+ preInstall: z.ZodOptional<z.ZodString>;
127
+ postInstall: z.ZodOptional<z.ZodString>;
128
+ preRemove: z.ZodOptional<z.ZodString>;
129
+ postRemove: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strict>>;
131
+ node: z.ZodOptional<z.ZodObject<{
132
+ source: z.ZodOptional<z.ZodEnum<{
133
+ path: "path";
134
+ download: "download";
135
+ host: "host";
136
+ }>>;
137
+ version: z.ZodOptional<z.ZodString>;
138
+ path: z.ZodOptional<z.ZodString>;
139
+ shouldStrip: z.ZodOptional<z.ZodBoolean>;
140
+ shouldUseCompileCache: z.ZodOptional<z.ZodBoolean>;
141
+ }, z.core.$strict>>;
142
+ signing: z.ZodOptional<z.ZodObject<{
143
+ appimage: z.ZodOptional<z.ZodObject<{
144
+ gpgKeyId: z.ZodString;
145
+ }, z.core.$strict>>;
146
+ deb: z.ZodOptional<z.ZodObject<{
147
+ keyFile: z.ZodString;
148
+ keyId: z.ZodOptional<z.ZodString>;
149
+ method: z.ZodOptional<z.ZodEnum<{
150
+ debsign: "debsign";
151
+ "dpkg-sig": "dpkg-sig";
152
+ }>>;
153
+ type: z.ZodOptional<z.ZodEnum<{
154
+ origin: "origin";
155
+ archive: "archive";
156
+ maint: "maint";
157
+ }>>;
158
+ signer: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strict>>;
160
+ flatpak: z.ZodOptional<z.ZodObject<{
161
+ gpgKeyId: z.ZodString;
162
+ gpgHomeDir: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strict>>;
164
+ rpm: z.ZodOptional<z.ZodObject<{
165
+ keyFile: z.ZodString;
166
+ keyId: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strict>>;
168
+ }, z.core.$strict>>;
169
+ appimage: z.ZodOptional<z.ZodObject<{
170
+ fileName: z.ZodOptional<z.ZodString>;
171
+ compression: z.ZodOptional<z.ZodEnum<{
172
+ gzip: "gzip";
173
+ xz: "xz";
174
+ zstd: "zstd";
175
+ }>>;
176
+ updateInformation: z.ZodOptional<z.ZodString>;
177
+ runtimeFile: z.ZodOptional<z.ZodString>;
178
+ }, z.core.$strict>>;
179
+ deb: z.ZodOptional<z.ZodObject<{
180
+ packageName: z.ZodOptional<z.ZodString>;
181
+ section: z.ZodOptional<z.ZodString>;
182
+ priority: z.ZodOptional<z.ZodString>;
183
+ compression: z.ZodOptional<z.ZodEnum<{
184
+ gzip: "gzip";
185
+ xz: "xz";
186
+ zstd: "zstd";
187
+ none: "none";
188
+ }>>;
189
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
190
+ }, z.core.$strict>>;
191
+ flatpak: z.ZodOptional<z.ZodObject<{
192
+ mode: z.ZodOptional<z.ZodEnum<{
193
+ prebuilt: "prebuilt";
194
+ source: "source";
195
+ }>>;
196
+ runtime: z.ZodOptional<z.ZodString>;
197
+ runtimeVersion: z.ZodOptional<z.ZodString>;
198
+ sdk: z.ZodOptional<z.ZodString>;
199
+ nodeExtension: z.ZodOptional<z.ZodString>;
200
+ sdkExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
201
+ base: z.ZodOptional<z.ZodString>;
202
+ baseVersion: z.ZodOptional<z.ZodString>;
203
+ branch: z.ZodOptional<z.ZodString>;
204
+ finishArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
205
+ cleanup: z.ZodOptional<z.ZodArray<z.ZodString>>;
206
+ buildCommands: z.ZodOptional<z.ZodArray<z.ZodString>>;
207
+ modules: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
208
+ source: z.ZodOptional<z.ZodObject<{
209
+ url: z.ZodOptional<z.ZodURL>;
210
+ tag: z.ZodOptional<z.ZodString>;
211
+ commit: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strict>>;
213
+ packageManager: z.ZodOptional<z.ZodEnum<{
214
+ npm: "npm";
215
+ pnpm: "pnpm";
216
+ yarn: "yarn";
217
+ }>>;
218
+ lockfile: z.ZodOptional<z.ZodString>;
219
+ runtimeRepo: z.ZodOptional<z.ZodURL>;
220
+ shouldEmitBundle: z.ZodOptional<z.ZodBoolean>;
221
+ shouldInstall: z.ZodOptional<z.ZodBoolean>;
222
+ shouldUseRofilesFuse: z.ZodOptional<z.ZodBoolean>;
223
+ }, z.core.$strict>>;
224
+ rpm: z.ZodOptional<z.ZodObject<{
225
+ packageName: z.ZodOptional<z.ZodString>;
226
+ group: z.ZodOptional<z.ZodString>;
227
+ compression: z.ZodOptional<z.ZodEnum<{
228
+ gzip: "gzip";
229
+ xz: "xz";
230
+ zstd: "zstd";
231
+ lzma: "lzma";
232
+ }>>;
233
+ prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
234
+ }, z.core.$strict>>;
235
+ }, z.core.$strict>;
236
+ export { deploySchema };
237
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiMxB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
package/dist/deploy.js ADDED
@@ -0,0 +1,232 @@
1
+ import { z } from "zod";
2
+ import { fileExtension, flag, relativePathRecord, text, textList, textRecord, url } from "./schema-text.js";
3
+ const APPIMAGE_COMPRESSIONS = ["gzip", "xz", "zstd"];
4
+ const DEB_COMPRESSIONS = ["gzip", "none", "xz", "zstd"];
5
+ const DEB_SIGN_METHODS = ["debsign", "dpkg-sig"];
6
+ const DEB_SIGN_TYPES = ["archive", "maint", "origin"];
7
+ const DEPLOY_TARGET_NAMES = ["appimage", "deb", "flatpak", "rpm"];
8
+ const FLATPAK_MODES = ["prebuilt", "source"];
9
+ const NODE_SOURCES = ["download", "host", "path"];
10
+ const OARS_INTENSITIES = ["intense", "mild", "moderate", "none"];
11
+ const PACKAGE_MANAGERS = ["npm", "pnpm", "yarn"];
12
+ const RELEASE_TYPES = ["development", "snapshot", "stable"];
13
+ const RELEASE_URGENCIES = ["critical", "high", "low", "medium"];
14
+ const RPM_COMPRESSIONS = ["gzip", "lzma", "xz", "zstd"];
15
+ const URL_KINDS = [
16
+ "bugtracker",
17
+ "contact",
18
+ "contribute",
19
+ "donation",
20
+ "faq",
21
+ "help",
22
+ "translate",
23
+ "vcs-browser",
24
+ ];
25
+ const BOOLEAN_ERROR = "must be a boolean";
26
+ const EPOCH_ERROR = "must be a non-negative integer";
27
+ const HEX_COLOR_ERROR = "must be a #rrggbb color";
28
+ const HEX_COLOR_PATTERN = /^#[\dA-Fa-f]{6}$/;
29
+ const KEY_FILE_ERROR = "must be a path to a PGP key file";
30
+ const KEY_ID_ERROR = "must be a PGP key id";
31
+ const SCRIPT_ERROR = "must be a path to a shell script";
32
+ const SPDX_ERROR = "must be an SPDX license expression";
33
+ const URL_ERROR = "must be an absolute URL";
34
+ const VERSION_ERROR = "must be a version string";
35
+ const hexColorSchema = z.string({ error: HEX_COLOR_ERROR }).regex(HEX_COLOR_PATTERN, { error: HEX_COLOR_ERROR });
36
+ const relationsSchema = z.strictObject({
37
+ deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
38
+ rpm: textList("RPM package relation", "must be an array of RPM package relations").optional(),
39
+ });
40
+ const developerSchema = z.strictObject({
41
+ id: text("must be a reverse-DNS developer id").optional(),
42
+ name: text("must be a developer or organization name").optional(),
43
+ email: text("must be an email address").optional(),
44
+ });
45
+ const screenshotSchema = z
46
+ .strictObject({
47
+ url: url("must be an absolute URL to a PNG or JPEG").optional(),
48
+ file: text("must be an image path relative to the project root").optional(),
49
+ caption: text("must be a screenshot caption").optional(),
50
+ isDefault: flag(BOOLEAN_ERROR).optional(),
51
+ })
52
+ .refine((entry) => entry.url !== undefined || entry.file !== undefined, {
53
+ error: "must have either a `url` or a `file`",
54
+ });
55
+ const releaseSchema = z.strictObject({
56
+ version: text(VERSION_ERROR),
57
+ date: z.iso.date({ error: "must be an ISO date (YYYY-MM-DD)" }),
58
+ type: z.enum(RELEASE_TYPES, { error: "must be one of development, snapshot, stable" }).optional(),
59
+ urgency: z.enum(RELEASE_URGENCIES, { error: "must be one of critical, high, low, medium" }).optional(),
60
+ notes: textList("release note paragraph", "must be an array of release note paragraphs").optional(),
61
+ url: url(URL_ERROR).optional(),
62
+ });
63
+ const fileAssociationSchema = z.strictObject({
64
+ extension: fileExtension("must be a file extension without a leading dot"),
65
+ mimeType: text("must be a MIME type such as text/plain"),
66
+ description: text("must be a description of the file type").optional(),
67
+ });
68
+ const desktopActionSchema = z.strictObject({
69
+ name: text("must be an action name"),
70
+ args: textList("argument", "must be an array of arguments appended to Exec").optional(),
71
+ icon: text("must be an icon name").optional(),
72
+ });
73
+ const brandingSchema = z.strictObject({
74
+ light: hexColorSchema,
75
+ dark: hexColorSchema,
76
+ });
77
+ const nodeRuntimeSchema = z.strictObject({
78
+ source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
79
+ version: text("must be a Node.js version such as 24.19.0").optional(),
80
+ path: text("must be a path to a node binary").optional(),
81
+ shouldStrip: flag(BOOLEAN_ERROR).optional(),
82
+ shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),
83
+ });
84
+ const scriptsSchema = z.strictObject({
85
+ preInstall: text(SCRIPT_ERROR).optional(),
86
+ postInstall: text(SCRIPT_ERROR).optional(),
87
+ preRemove: text(SCRIPT_ERROR).optional(),
88
+ postRemove: text(SCRIPT_ERROR).optional(),
89
+ });
90
+ const debSchema = z.strictObject({
91
+ packageName: text("must be a Debian package name").optional(),
92
+ section: text("must be a Debian archive section").optional(),
93
+ priority: text("must be a Debian priority").optional(),
94
+ compression: z.enum(DEB_COMPRESSIONS, { error: "must be one of gzip, none, xz, zstd" }).optional(),
95
+ fields: textRecord("must be a control field value", "must be a record of control field names to values")
96
+ .optional(),
97
+ });
98
+ const rpmSchema = z.strictObject({
99
+ packageName: text("must be an RPM package name").optional(),
100
+ group: text("must be an RPM group").optional(),
101
+ compression: z.enum(RPM_COMPRESSIONS, { error: "must be one of gzip, lzma, xz, zstd" }).optional(),
102
+ prefixes: textList("prefix", "must be an array of relocation prefixes").optional(),
103
+ });
104
+ const appimageSchema = z.strictObject({
105
+ fileName: text("must be an output file name").optional(),
106
+ compression: z.enum(APPIMAGE_COMPRESSIONS, { error: "must be one of gzip, xz, zstd" }).optional(),
107
+ updateInformation: text("must be an AppImage update information string").optional(),
108
+ runtimeFile: text("must be a path to an AppImage runtime file").optional(),
109
+ });
110
+ const flatpakSourceSchema = z.strictObject({
111
+ url: url("must be an absolute git URL").optional(),
112
+ tag: text("must be a git tag").optional(),
113
+ commit: text("must be a git commit sha").optional(),
114
+ });
115
+ const flatpakSchema = z.strictObject({
116
+ mode: z.enum(FLATPAK_MODES, { error: 'must be "prebuilt" or "source"' }).optional(),
117
+ runtime: text("must be a runtime id").optional(),
118
+ runtimeVersion: text('must be a runtime branch such as "50"').optional(),
119
+ sdk: text("must be an SDK id").optional(),
120
+ nodeExtension: text("must be a Node SDK extension id").optional(),
121
+ sdkExtensions: textList("SDK extension id", "must be an array of SDK extension ids").optional(),
122
+ base: text("must be a base app id").optional(),
123
+ baseVersion: text("must be a base app version").optional(),
124
+ branch: text("must be a branch name").optional(),
125
+ finishArgs: textList("finish argument", "must be an array of flatpak finish arguments").optional(),
126
+ cleanup: textList("cleanup pattern", "must be an array of cleanup patterns").optional(),
127
+ buildCommands: textList("shell command", "must be an array of shell commands").optional(),
128
+ modules: z.array(z.unknown(), { error: "must be an array of flatpak module objects" }).optional(),
129
+ source: flatpakSourceSchema.optional(),
130
+ packageManager: z.enum(PACKAGE_MANAGERS, { error: "must be one of npm, pnpm, yarn" }).optional(),
131
+ lockfile: text("must be a path to a lockfile").optional(),
132
+ runtimeRepo: url("must be an absolute .flatpakrepo URL").optional(),
133
+ shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),
134
+ shouldInstall: flag(BOOLEAN_ERROR).optional(),
135
+ shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),
136
+ });
137
+ const debSigningSchema = z.strictObject({
138
+ keyFile: text(KEY_FILE_ERROR),
139
+ keyId: text(KEY_ID_ERROR).optional(),
140
+ method: z.enum(DEB_SIGN_METHODS, { error: 'must be "debsign" or "dpkg-sig"' }).optional(),
141
+ type: z.enum(DEB_SIGN_TYPES, { error: "must be one of archive, maint, origin" }).optional(),
142
+ signer: text("must be a signer name and email").optional(),
143
+ });
144
+ const rpmSigningSchema = z.strictObject({
145
+ keyFile: text(KEY_FILE_ERROR),
146
+ keyId: text(KEY_ID_ERROR).optional(),
147
+ });
148
+ const flatpakSigningSchema = z.strictObject({
149
+ gpgKeyId: text("must be a GPG key id"),
150
+ gpgHomeDir: text("must be a path to a GPG home directory").optional(),
151
+ });
152
+ const appimageSigningSchema = z.strictObject({
153
+ gpgKeyId: text("must be a GPG key id"),
154
+ });
155
+ const signingSchema = z.strictObject({
156
+ appimage: appimageSigningSchema.optional(),
157
+ deb: debSigningSchema.optional(),
158
+ flatpak: flatpakSigningSchema.optional(),
159
+ rpm: rpmSigningSchema.optional(),
160
+ });
161
+ const extraRelationsSchema = z.strictObject({
162
+ recommends: relationsSchema.optional(),
163
+ suggests: relationsSchema.optional(),
164
+ provides: relationsSchema.optional(),
165
+ conflicts: relationsSchema.optional(),
166
+ replaces: relationsSchema.optional(),
167
+ breaks: relationsSchema.optional(),
168
+ preDepends: relationsSchema.optional(),
169
+ });
170
+ const deploySchema = z.strictObject({
171
+ targets: z
172
+ .array(z.enum(DEPLOY_TARGET_NAMES, { error: "must be one of appimage, deb, flatpak, rpm" }), {
173
+ error: "must be an array of deploy targets",
174
+ })
175
+ .optional(),
176
+ outDir: text("must be a directory path relative to the project root").optional(),
177
+ name: text("must be the display name shown in the launcher").optional(),
178
+ genericName: text("must be a generic application name").optional(),
179
+ binaryName: text("must be a kebab-case command name").optional(),
180
+ version: text(VERSION_ERROR).optional(),
181
+ release: text("must be a packaging revision").optional(),
182
+ epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),
183
+ summary: text("must be a single-line summary without a trailing period").optional(),
184
+ description: textList("description paragraph", "must be an array of description paragraphs").optional(),
185
+ keywords: textList("search keyword", "must be an array of search keywords").optional(),
186
+ categories: textList("freedesktop category", "must be an array of freedesktop categories").optional(),
187
+ mimeTypes: textList("MIME type", "must be an array of MIME types").optional(),
188
+ developer: developerSchema.optional(),
189
+ license: text(SPDX_ERROR).optional(),
190
+ licenseFile: text("must be a path to a license file").optional(),
191
+ metadataLicense: text(SPDX_ERROR).optional(),
192
+ copyright: text("must be a copyright line").optional(),
193
+ homepage: url(URL_ERROR).optional(),
194
+ urls: z
195
+ .partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {
196
+ error: "must be a record of AppStream url kinds to URLs",
197
+ })
198
+ .optional(),
199
+ icons: text("must be a path to an icon theme directory or a single icon file").optional(),
200
+ screenshots: z.array(screenshotSchema, { error: "must be an array of screenshots" }).optional(),
201
+ screenshotBaseUrl: url("must be an absolute base URL").optional(),
202
+ branding: brandingSchema.optional(),
203
+ contentRating: z
204
+ .record(z.string(), z.enum(OARS_INTENSITIES, { error: "must be one of intense, mild, moderate, none" }), {
205
+ error: "must be a record of OARS 1.1 attribute ids to intensities",
206
+ })
207
+ .optional(),
208
+ releases: z.array(releaseSchema, { error: "must be an array of releases" }).optional(),
209
+ execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
210
+ fileAssociations: z
211
+ .array(fileAssociationSchema, { error: "must be an array of file associations" })
212
+ .optional(),
213
+ protocols: textList("URL scheme", "must be an array of URL schemes").optional(),
214
+ desktopActions: z
215
+ .record(z.string(), desktopActionSchema, { error: "must be a record of action ids to actions" })
216
+ .optional(),
217
+ desktopEntry: textRecord("must be a desktop entry value", "must be a record of desktop entry keys to values")
218
+ .optional(),
219
+ isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
220
+ extraFiles: relativePathRecord("must be a destination path inside the install prefix, without a leading slash or a .. segment", "must be a source path", "must be a record of prefix-relative destinations to source paths").optional(),
221
+ depends: relationsSchema.optional(),
222
+ relations: extraRelationsSchema.optional(),
223
+ scripts: scriptsSchema.optional(),
224
+ node: nodeRuntimeSchema.optional(),
225
+ signing: signingSchema.optional(),
226
+ appimage: appimageSchema.optional(),
227
+ deb: debSchema.optional(),
228
+ flatpak: flatpakSchema.optional(),
229
+ rpm: rpmSchema.optional(),
230
+ });
231
+ export { deploySchema };
232
+ //# sourceMappingURL=deploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"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aAAa,CAAC,QAAQ,EAAE;IACjC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;IACzB,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { fileExtension, flag, relativePathRecord, text, textList, textRecord, url } from \"./schema-text.ts\";\n\nconst APPIMAGE_COMPRESSIONS = [\"gzip\", \"xz\", \"zstd\"] as const;\nconst DEB_COMPRESSIONS = [\"gzip\", \"none\", \"xz\", \"zstd\"] as const;\nconst DEB_SIGN_METHODS = [\"debsign\", \"dpkg-sig\"] as const;\nconst DEB_SIGN_TYPES = [\"archive\", \"maint\", \"origin\"] as const;\nconst DEPLOY_TARGET_NAMES = [\"appimage\", \"deb\", \"flatpak\", \"rpm\"] as const;\nconst FLATPAK_MODES = [\"prebuilt\", \"source\"] as const;\nconst NODE_SOURCES = [\"download\", \"host\", \"path\"] as const;\nconst OARS_INTENSITIES = [\"intense\", \"mild\", \"moderate\", \"none\"] as const;\nconst PACKAGE_MANAGERS = [\"npm\", \"pnpm\", \"yarn\"] as const;\nconst RELEASE_TYPES = [\"development\", \"snapshot\", \"stable\"] as const;\nconst RELEASE_URGENCIES = [\"critical\", \"high\", \"low\", \"medium\"] as const;\nconst RPM_COMPRESSIONS = [\"gzip\", \"lzma\", \"xz\", \"zstd\"] as const;\n\nconst URL_KINDS = [\n \"bugtracker\",\n \"contact\",\n \"contribute\",\n \"donation\",\n \"faq\",\n \"help\",\n \"translate\",\n \"vcs-browser\",\n] as const;\n\nconst BOOLEAN_ERROR = \"must be a boolean\";\nconst EPOCH_ERROR = \"must be a non-negative integer\";\nconst HEX_COLOR_ERROR = \"must be a #rrggbb color\";\nconst HEX_COLOR_PATTERN = /^#[\\dA-Fa-f]{6}$/;\nconst KEY_FILE_ERROR = \"must be a path to a PGP key file\";\nconst KEY_ID_ERROR = \"must be a PGP key id\";\nconst SCRIPT_ERROR = \"must be a path to a shell script\";\nconst SPDX_ERROR = \"must be an SPDX license expression\";\nconst URL_ERROR = \"must be an absolute URL\";\nconst VERSION_ERROR = \"must be a version string\";\nconst hexColorSchema = z.string({ error: HEX_COLOR_ERROR }).regex(HEX_COLOR_PATTERN, { error: HEX_COLOR_ERROR });\n\nconst relationsSchema = z.strictObject({\n deb: textList(\"Debian package relation\", \"must be an array of Debian package relations\").optional(),\n rpm: textList(\"RPM package relation\", \"must be an array of RPM package relations\").optional(),\n});\n\nconst developerSchema = z.strictObject({\n id: text(\"must be a reverse-DNS developer id\").optional(),\n name: text(\"must be a developer or organization name\").optional(),\n email: text(\"must be an email address\").optional(),\n});\n\nconst screenshotSchema = z\n .strictObject({\n url: url(\"must be an absolute URL to a PNG or JPEG\").optional(),\n file: text(\"must be an image path relative to the project root\").optional(),\n caption: text(\"must be a screenshot caption\").optional(),\n isDefault: flag(BOOLEAN_ERROR).optional(),\n })\n .refine((entry) => entry.url !== undefined || entry.file !== undefined, {\n error: \"must have either a `url` or a `file`\",\n });\n\nconst releaseSchema = z.strictObject({\n version: text(VERSION_ERROR),\n date: z.iso.date({ error: \"must be an ISO date (YYYY-MM-DD)\" }),\n type: z.enum(RELEASE_TYPES, { error: \"must be one of development, snapshot, stable\" }).optional(),\n urgency: z.enum(RELEASE_URGENCIES, { error: \"must be one of critical, high, low, medium\" }).optional(),\n notes: textList(\"release note paragraph\", \"must be an array of release note paragraphs\").optional(),\n url: url(URL_ERROR).optional(),\n});\n\nconst fileAssociationSchema = z.strictObject({\n extension: fileExtension(\"must be a file extension without a leading dot\"),\n mimeType: text(\"must be a MIME type such as text/plain\"),\n description: text(\"must be a description of the file type\").optional(),\n});\n\nconst desktopActionSchema = z.strictObject({\n name: text(\"must be an action name\"),\n args: textList(\"argument\", \"must be an array of arguments appended to Exec\").optional(),\n icon: text(\"must be an icon name\").optional(),\n});\n\nconst brandingSchema = z.strictObject({\n light: hexColorSchema,\n dark: hexColorSchema,\n});\n\nconst nodeRuntimeSchema = z.strictObject({\n source: z.enum(NODE_SOURCES, { error: \"must be one of download, host, path\" }).optional(),\n version: text(\"must be a Node.js version such as 24.19.0\").optional(),\n path: text(\"must be a path to a node binary\").optional(),\n shouldStrip: flag(BOOLEAN_ERROR).optional(),\n shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),\n});\n\nconst scriptsSchema = z.strictObject({\n preInstall: text(SCRIPT_ERROR).optional(),\n postInstall: text(SCRIPT_ERROR).optional(),\n preRemove: text(SCRIPT_ERROR).optional(),\n postRemove: text(SCRIPT_ERROR).optional(),\n});\n\nconst debSchema = z.strictObject({\n packageName: text(\"must be a Debian package name\").optional(),\n section: text(\"must be a Debian archive section\").optional(),\n priority: text(\"must be a Debian priority\").optional(),\n compression: z.enum(DEB_COMPRESSIONS, { error: \"must be one of gzip, none, xz, zstd\" }).optional(),\n fields: textRecord(\"must be a control field value\", \"must be a record of control field names to values\")\n .optional(),\n});\n\nconst rpmSchema = z.strictObject({\n packageName: text(\"must be an RPM package name\").optional(),\n group: text(\"must be an RPM group\").optional(),\n compression: z.enum(RPM_COMPRESSIONS, { error: \"must be one of gzip, lzma, xz, zstd\" }).optional(),\n prefixes: textList(\"prefix\", \"must be an array of relocation prefixes\").optional(),\n});\n\nconst appimageSchema = z.strictObject({\n fileName: text(\"must be an output file name\").optional(),\n compression: z.enum(APPIMAGE_COMPRESSIONS, { error: \"must be one of gzip, xz, zstd\" }).optional(),\n updateInformation: text(\"must be an AppImage update information string\").optional(),\n runtimeFile: text(\"must be a path to an AppImage runtime file\").optional(),\n});\n\nconst flatpakSourceSchema = z.strictObject({\n url: url(\"must be an absolute git URL\").optional(),\n tag: text(\"must be a git tag\").optional(),\n commit: text(\"must be a git commit sha\").optional(),\n});\n\nconst flatpakSchema = z.strictObject({\n mode: z.enum(FLATPAK_MODES, { error: 'must be \"prebuilt\" or \"source\"' }).optional(),\n runtime: text(\"must be a runtime id\").optional(),\n runtimeVersion: text('must be a runtime branch such as \"50\"').optional(),\n sdk: text(\"must be an SDK id\").optional(),\n nodeExtension: text(\"must be a Node SDK extension id\").optional(),\n sdkExtensions: textList(\"SDK extension id\", \"must be an array of SDK extension ids\").optional(),\n base: text(\"must be a base app id\").optional(),\n baseVersion: text(\"must be a base app version\").optional(),\n branch: text(\"must be a branch name\").optional(),\n finishArgs: textList(\"finish argument\", \"must be an array of flatpak finish arguments\").optional(),\n cleanup: textList(\"cleanup pattern\", \"must be an array of cleanup patterns\").optional(),\n buildCommands: textList(\"shell command\", \"must be an array of shell commands\").optional(),\n modules: z.array(z.unknown(), { error: \"must be an array of flatpak module objects\" }).optional(),\n source: flatpakSourceSchema.optional(),\n packageManager: z.enum(PACKAGE_MANAGERS, { error: \"must be one of npm, pnpm, yarn\" }).optional(),\n lockfile: text(\"must be a path to a lockfile\").optional(),\n runtimeRepo: url(\"must be an absolute .flatpakrepo URL\").optional(),\n shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),\n shouldInstall: flag(BOOLEAN_ERROR).optional(),\n shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),\n});\n\nconst debSigningSchema = z.strictObject({\n keyFile: text(KEY_FILE_ERROR),\n keyId: text(KEY_ID_ERROR).optional(),\n method: z.enum(DEB_SIGN_METHODS, { error: 'must be \"debsign\" or \"dpkg-sig\"' }).optional(),\n type: z.enum(DEB_SIGN_TYPES, { error: \"must be one of archive, maint, origin\" }).optional(),\n signer: text(\"must be a signer name and email\").optional(),\n});\n\nconst rpmSigningSchema = z.strictObject({\n keyFile: text(KEY_FILE_ERROR),\n keyId: text(KEY_ID_ERROR).optional(),\n});\n\nconst flatpakSigningSchema = z.strictObject({\n gpgKeyId: text(\"must be a GPG key id\"),\n gpgHomeDir: text(\"must be a path to a GPG home directory\").optional(),\n});\n\nconst appimageSigningSchema = z.strictObject({\n gpgKeyId: text(\"must be a GPG key id\"),\n});\n\nconst signingSchema = z.strictObject({\n appimage: appimageSigningSchema.optional(),\n deb: debSigningSchema.optional(),\n flatpak: flatpakSigningSchema.optional(),\n rpm: rpmSigningSchema.optional(),\n});\n\nconst extraRelationsSchema = z.strictObject({\n recommends: relationsSchema.optional(),\n suggests: relationsSchema.optional(),\n provides: relationsSchema.optional(),\n conflicts: relationsSchema.optional(),\n replaces: relationsSchema.optional(),\n breaks: relationsSchema.optional(),\n preDepends: relationsSchema.optional(),\n});\n\nconst deploySchema = z.strictObject({\n targets: z\n .array(z.enum(DEPLOY_TARGET_NAMES, { error: \"must be one of appimage, deb, flatpak, rpm\" }), {\n error: \"must be an array of deploy targets\",\n })\n .optional(),\n outDir: text(\"must be a directory path relative to the project root\").optional(),\n name: text(\"must be the display name shown in the launcher\").optional(),\n genericName: text(\"must be a generic application name\").optional(),\n binaryName: text(\"must be a kebab-case command name\").optional(),\n version: text(VERSION_ERROR).optional(),\n release: text(\"must be a packaging revision\").optional(),\n epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),\n summary: text(\"must be a single-line summary without a trailing period\").optional(),\n description: textList(\"description paragraph\", \"must be an array of description paragraphs\").optional(),\n keywords: textList(\"search keyword\", \"must be an array of search keywords\").optional(),\n categories: textList(\"freedesktop category\", \"must be an array of freedesktop categories\").optional(),\n mimeTypes: textList(\"MIME type\", \"must be an array of MIME types\").optional(),\n developer: developerSchema.optional(),\n license: text(SPDX_ERROR).optional(),\n licenseFile: text(\"must be a path to a license file\").optional(),\n metadataLicense: text(SPDX_ERROR).optional(),\n copyright: text(\"must be a copyright line\").optional(),\n homepage: url(URL_ERROR).optional(),\n urls: z\n .partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {\n error: \"must be a record of AppStream url kinds to URLs\",\n })\n .optional(),\n icons: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n screenshots: z.array(screenshotSchema, { error: \"must be an array of screenshots\" }).optional(),\n screenshotBaseUrl: url(\"must be an absolute base URL\").optional(),\n branding: brandingSchema.optional(),\n contentRating: z\n .record(z.string(), z.enum(OARS_INTENSITIES, { error: \"must be one of intense, mild, moderate, none\" }), {\n error: \"must be a record of OARS 1.1 attribute ids to intensities\",\n })\n .optional(),\n releases: z.array(releaseSchema, { error: \"must be an array of releases\" }).optional(),\n execArgs: textList(\"argument\", \"must be an array of arguments appended to Exec\").optional(),\n fileAssociations: z\n .array(fileAssociationSchema, { error: \"must be an array of file associations\" })\n .optional(),\n protocols: textList(\"URL scheme\", \"must be an array of URL schemes\").optional(),\n desktopActions: z\n .record(z.string(), desktopActionSchema, { error: \"must be a record of action ids to actions\" })\n .optional(),\n desktopEntry: textRecord(\"must be a desktop entry value\", \"must be a record of desktop entry keys to values\")\n .optional(),\n isDbusActivatable: flag(BOOLEAN_ERROR).optional(),\n extraFiles: relativePathRecord(\n \"must be a destination path inside the install prefix, without a leading slash or a .. segment\",\n \"must be a source path\",\n \"must be a record of prefix-relative destinations to source paths\",\n ).optional(),\n depends: relationsSchema.optional(),\n relations: extraRelationsSchema.optional(),\n scripts: scriptsSchema.optional(),\n node: nodeRuntimeSchema.optional(),\n signing: signingSchema.optional(),\n appimage: appimageSchema.optional(),\n deb: debSchema.optional(),\n flatpak: flatpakSchema.optional(),\n rpm: rpmSchema.optional(),\n});\n\nexport { deploySchema };\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** @public */
2
2
  export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from "./config.ts";
3
3
  /** @public */
4
- export { type LoadedConfig, loadConfig } from "./loader.ts";
4
+ export { type ConfigLoader, type LoadedConfig, loadConfig } from "./loader.ts";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc;AACd,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc;AACd,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}