@confect/cli 1.0.0-next.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 +12 -0
- package/LICENSE +7 -0
- package/dist/FunctionPath.mjs +19 -0
- package/dist/FunctionPath.mjs.map +1 -0
- package/dist/FunctionPaths.mjs +41 -0
- package/dist/FunctionPaths.mjs.map +1 -0
- package/dist/GroupPath.mjs +52 -0
- package/dist/GroupPath.mjs.map +1 -0
- package/dist/GroupPaths.mjs +9 -0
- package/dist/GroupPaths.mjs.map +1 -0
- package/dist/_virtual/rolldown_runtime.mjs +28 -0
- package/dist/cliApp.mjs +13 -0
- package/dist/cliApp.mjs.map +1 -0
- package/dist/confect/codegen.mjs +111 -0
- package/dist/confect/codegen.mjs.map +1 -0
- package/dist/confect/dev.mjs +253 -0
- package/dist/confect/dev.mjs.map +1 -0
- package/dist/confect.mjs +14 -0
- package/dist/confect.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/dist/log.mjs +25 -0
- package/dist/log.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.mjs +12 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.mjs +15 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodePath.mjs +25 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodePath.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.mjs +12 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.mjs +17 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.mjs +129 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.mjs +43 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.mjs +329 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/path.mjs +51 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/path.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/runtime.mjs +31 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/runtime.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.mjs +24 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.mjs +91 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.mjs +75 -0
- package/dist/node_modules/.pnpm/@effect_platform-node-shared@0.53.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeContext.mjs +21 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeContext.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeFileSystem.mjs +15 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeFileSystem.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeRuntime.mjs +15 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeRuntime.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeWorker.mjs +27 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeWorker.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/internal/worker.mjs +71 -0
- package/dist/node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/internal/worker.mjs.map +1 -0
- package/dist/packages/cli/package.mjs +6 -0
- package/dist/packages/cli/package.mjs.map +1 -0
- package/dist/packages/core/dist/Spec.mjs +23 -0
- package/dist/packages/core/dist/Spec.mjs.map +1 -0
- package/dist/packages/core/dist/_virtual/rolldown_runtime.mjs +14 -0
- package/dist/packages/core/dist/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/services/ConfectDirectory.mjs +31 -0
- package/dist/services/ConfectDirectory.mjs.map +1 -0
- package/dist/services/ConvexDirectory.mjs +41 -0
- package/dist/services/ConvexDirectory.mjs.map +1 -0
- package/dist/services/ProjectRoot.mjs +35 -0
- package/dist/services/ProjectRoot.mjs.map +1 -0
- package/dist/templates.mjs +204 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/utils.mjs +162 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +86 -0
- package/src/FunctionPath.ts +28 -0
- package/src/FunctionPaths.ts +103 -0
- package/src/GroupPath.ts +117 -0
- package/src/GroupPaths.ts +7 -0
- package/src/cliApp.ts +8 -0
- package/src/confect/codegen.ts +228 -0
- package/src/confect/dev.ts +611 -0
- package/src/confect.ts +19 -0
- package/src/index.ts +22 -0
- package/src/log.ts +106 -0
- package/src/services/ConfectDirectory.ts +41 -0
- package/src/services/ConvexDirectory.ts +67 -0
- package/src/services/ProjectRoot.ts +49 -0
- package/src/templates.ts +380 -0
- package/src/utils.ts +332 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.mjs","names":["pendingInit: Pending","GroupPath.toString","specResult: Option.Option<ReadonlyArray<FileChange>>","FunctionPaths.make","FunctionPaths.diff","GroupPath.modulePath","optionalChanges: ReadonlyArray<FileChange>","Spec","optionalConfectFiles: ReadonlyRecord<string, keyof Pending>"],"sources":["../../src/confect/dev.ts"],"sourcesContent":["import { Spec } from \"@confect/core\";\nimport { Command } from \"@effect/cli\";\nimport { FileSystem, Path } from \"@effect/platform\";\nimport { Ansi, AnsiDoc } from \"@effect/printer-ansi\";\nimport {\n Array,\n Console,\n Data,\n Duration,\n Effect,\n Equal,\n HashSet,\n Match,\n Option,\n pipe,\n Queue,\n Ref,\n Schema,\n Stream,\n String,\n} from \"effect\";\nimport type { ReadonlyRecord } from \"effect/Record\";\nimport * as esbuild from \"esbuild\";\nimport * as tsx from \"tsx/esm/api\";\nimport type * as FunctionPath from \"../FunctionPath\";\nimport * as FunctionPaths from \"../FunctionPaths\";\nimport * as GroupPath from \"../GroupPath\";\nimport { logCompleted, logFailed } from \"../log\";\nimport { ConfectDirectory } from \"../services/ConfectDirectory\";\nimport { ConvexDirectory } from \"../services/ConvexDirectory\";\nimport { ProjectRoot } from \"../services/ProjectRoot\";\nimport {\n generateAuthConfig,\n generateConvexConfig,\n generateCrons,\n generateHttp,\n removeGroups,\n writeGroups,\n} from \"../utils\";\nimport { codegenHandler } from \"./codegen\";\n\ntype Pending = {\n readonly specDirty: boolean;\n readonly httpDirty: boolean;\n readonly appDirty: boolean;\n readonly cronsDirty: boolean;\n readonly authDirty: boolean;\n};\n\nconst pendingInit: Pending = {\n specDirty: false,\n httpDirty: false,\n appDirty: false,\n cronsDirty: false,\n authDirty: false,\n};\n\ntype FileChange = Data.TaggedEnum<{\n OptionalFile: {\n readonly change: \"Added\" | \"Removed\" | \"Modified\";\n readonly filePath: string;\n };\n GroupModule: {\n readonly change: \"Added\" | \"Removed\" | \"Modified\";\n readonly filePath: string;\n readonly functionsAdded: ReadonlyArray<FunctionPath.FunctionPath>;\n readonly functionsRemoved: ReadonlyArray<FunctionPath.FunctionPath>;\n };\n}>;\n\nconst FileChange = Data.taggedEnum<FileChange>();\n\nconst logChangeReport = (changes: ReadonlyArray<FileChange>) =>\n Effect.gen(function* () {\n yield* logCompleted(\"Generated files are up-to-date\");\n\n yield* Effect.when(\n Effect.forEach(changes, (change) =>\n FileChange.$match(change, {\n OptionalFile: ({ change: c, filePath }) =>\n logFileChangeIndented(c, filePath),\n GroupModule: ({\n change: c,\n filePath,\n functionsAdded,\n functionsRemoved,\n }) =>\n Effect.gen(function* () {\n yield* logFileChangeIndented(c, filePath);\n yield* Effect.forEach(functionsAdded, logFunctionAddedIndented);\n yield* Effect.forEach(\n functionsRemoved,\n logFunctionRemovedIndented,\n );\n }),\n }),\n ),\n () => Array.isNonEmptyReadonlyArray(changes),\n );\n });\n\nconst changeChar = (change: \"Added\" | \"Removed\" | \"Modified\") =>\n Match.value(change).pipe(\n Match.when(\"Added\", () => ({ char: \"+\", color: Ansi.green })),\n Match.when(\"Removed\", () => ({ char: \"-\", color: Ansi.red })),\n Match.when(\"Modified\", () => ({ char: \"~\", color: Ansi.yellow })),\n Match.exhaustive,\n );\n\nconst logFileChangeIndented = (\n change: \"Added\" | \"Removed\" | \"Modified\",\n fullPath: string,\n) =>\n Effect.gen(function* () {\n const projectRoot = yield* ProjectRoot.get;\n const path = yield* Path.Path;\n\n const prefix = projectRoot + path.sep;\n const suffix = pipe(fullPath, String.startsWith(prefix))\n ? pipe(fullPath, String.slice(prefix.length))\n : fullPath;\n\n const { char, color } = changeChar(change);\n\n yield* Console.log(\n pipe(\n AnsiDoc.text(\" \"),\n AnsiDoc.cat(pipe(AnsiDoc.char(char), AnsiDoc.annotate(color))),\n AnsiDoc.catWithSpace(\n AnsiDoc.hcat([\n pipe(AnsiDoc.text(prefix), AnsiDoc.annotate(Ansi.blackBright)),\n pipe(AnsiDoc.text(suffix), AnsiDoc.annotate(color)),\n ]),\n ),\n AnsiDoc.render({ style: \"pretty\" }),\n ),\n );\n });\n\nconst logFunctionAddedIndented = (functionPath: FunctionPath.FunctionPath) =>\n Console.log(\n pipe(\n AnsiDoc.text(\" \"),\n AnsiDoc.cat(pipe(AnsiDoc.char(\"+\"), AnsiDoc.annotate(Ansi.green))),\n AnsiDoc.catWithSpace(\n AnsiDoc.hcat([\n pipe(\n AnsiDoc.text(GroupPath.toString(functionPath.groupPath) + \".\"),\n AnsiDoc.annotate(Ansi.blackBright),\n ),\n pipe(AnsiDoc.text(functionPath.name), AnsiDoc.annotate(Ansi.green)),\n ]),\n ),\n AnsiDoc.render({ style: \"pretty\" }),\n ),\n );\n\nconst logFunctionRemovedIndented = (functionPath: FunctionPath.FunctionPath) =>\n Console.log(\n pipe(\n AnsiDoc.text(\" \"),\n AnsiDoc.cat(pipe(AnsiDoc.char(\"-\"), AnsiDoc.annotate(Ansi.red))),\n AnsiDoc.catWithSpace(\n AnsiDoc.hcat([\n pipe(\n AnsiDoc.text(GroupPath.toString(functionPath.groupPath) + \".\"),\n AnsiDoc.annotate(Ansi.blackBright),\n ),\n pipe(AnsiDoc.text(functionPath.name), AnsiDoc.annotate(Ansi.red)),\n ]),\n ),\n AnsiDoc.render({ style: \"pretty\" }),\n ),\n );\n\nexport const dev = Command.make(\"dev\", {}, () =>\n Effect.gen(function* () {\n const initialFunctionPaths = yield* codegenHandler;\n\n const pendingRef = yield* Ref.make<Pending>(pendingInit);\n const signal = yield* Queue.sliding<void>(1);\n\n yield* Effect.all(\n [\n specFileWatcher(signal, pendingRef),\n confectDirectoryWatcher(signal, pendingRef),\n syncLoop(signal, pendingRef, initialFunctionPaths),\n ],\n { concurrency: \"unbounded\" },\n );\n }),\n).pipe(Command.withDescription(\"Start the Confect development server\"));\n\nconst syncLoop = (\n signal: Queue.Queue<void>,\n pendingRef: Ref.Ref<Pending>,\n initialFunctionPaths: FunctionPaths.FunctionPaths,\n) =>\n Effect.gen(function* () {\n const functionPathsRef = yield* Ref.make(initialFunctionPaths);\n const changesRef = yield* Ref.make<ReadonlyArray<FileChange>>([]);\n\n return yield* Effect.forever(\n Effect.gen(function* () {\n yield* Effect.logDebug(\"Running sync loop...\");\n yield* Queue.take(signal);\n\n const pending = yield* Ref.getAndSet(pendingRef, pendingInit);\n\n const specResult: Option.Option<ReadonlyArray<FileChange>> =\n yield* Effect.if(pending.specDirty, {\n onTrue: () =>\n loadSpec.pipe(\n Effect.andThen(\n Effect.fn(function* (spec) {\n yield* Effect.logDebug(\"Spec loaded\");\n\n const previous = yield* Ref.get(functionPathsRef);\n\n const path = yield* Path.Path;\n const convexDirectory = yield* ConvexDirectory.get;\n\n const current = FunctionPaths.make(spec);\n const {\n functionsAdded,\n functionsRemoved,\n groupsRemoved,\n groupsAdded,\n groupsChanged,\n } = FunctionPaths.diff(previous, current);\n\n // Removed groups\n yield* removeGroups(groupsRemoved);\n const removedChanges = yield* Effect.forEach(\n groupsRemoved,\n (gp) =>\n Effect.gen(function* () {\n const relativeModulePath =\n yield* GroupPath.modulePath(gp);\n return FileChange.GroupModule({\n change: \"Removed\",\n filePath: path.join(\n convexDirectory,\n relativeModulePath,\n ),\n functionsAdded: [],\n functionsRemoved: Array.fromIterable(\n HashSet.filter(functionsRemoved, (fp) =>\n Equal.equals(fp.groupPath, gp),\n ),\n ),\n });\n }),\n );\n\n // Added groups\n yield* writeGroups(spec, groupsAdded);\n const addedChanges = yield* Effect.forEach(\n groupsAdded,\n (gp) =>\n Effect.gen(function* () {\n const relativeModulePath =\n yield* GroupPath.modulePath(gp);\n return FileChange.GroupModule({\n change: \"Added\",\n filePath: path.join(\n convexDirectory,\n relativeModulePath,\n ),\n functionsAdded: Array.fromIterable(\n HashSet.filter(functionsAdded, (fp) =>\n Equal.equals(fp.groupPath, gp),\n ),\n ),\n functionsRemoved: [],\n });\n }),\n );\n\n // Changed groups\n yield* writeGroups(spec, groupsChanged);\n const changedChanges = yield* Effect.forEach(\n groupsChanged,\n (gp) =>\n Effect.gen(function* () {\n const relativeModulePath =\n yield* GroupPath.modulePath(gp);\n return FileChange.GroupModule({\n change: \"Modified\",\n filePath: path.join(\n convexDirectory,\n relativeModulePath,\n ),\n functionsAdded: Array.fromIterable(\n HashSet.filter(functionsAdded, (fp) =>\n Equal.equals(fp.groupPath, gp),\n ),\n ),\n functionsRemoved: Array.fromIterable(\n HashSet.filter(functionsRemoved, (fp) =>\n Equal.equals(fp.groupPath, gp),\n ),\n ),\n });\n }),\n );\n\n yield* Ref.set(functionPathsRef, current);\n\n return Option.some([\n ...removedChanges,\n ...addedChanges,\n ...changedChanges,\n ]);\n }),\n ),\n Effect.catchTag(\"SpecImportFailedError\", () =>\n logFailed(\"Spec import failed\").pipe(\n Effect.as(Option.none()),\n ),\n ),\n Effect.catchTag(\"SpecFileDoesNotExportSpecError\", () =>\n logFailed(\"Spec file does not default export a spec\").pipe(\n Effect.as(Option.none()),\n ),\n ),\n ),\n onFalse: () => Effect.succeed(Option.some([])),\n });\n\n const specChanges = Option.getOrElse(specResult, () => []);\n\n const dirtyOptionalFiles = [\n ...(pending.httpDirty\n ? [syncOptionalFile(generateHttp, \"http.ts\")]\n : []),\n ...(pending.appDirty\n ? [syncOptionalFile(generateConvexConfig, \"convex.config.ts\")]\n : []),\n ...(pending.cronsDirty\n ? [syncOptionalFile(generateCrons, \"crons.ts\")]\n : []),\n ...(pending.authDirty\n ? [syncOptionalFile(generateAuthConfig, \"auth.config.ts\")]\n : []),\n ];\n\n const optionalChanges: ReadonlyArray<FileChange> =\n Array.isNonEmptyReadonlyArray(dirtyOptionalFiles)\n ? yield* pipe(\n Effect.all(dirtyOptionalFiles, {\n concurrency: \"unbounded\",\n }),\n Effect.map(Array.getSomes),\n )\n : [];\n\n yield* Ref.update(changesRef, (prev) => [\n ...prev,\n ...specChanges,\n ...optionalChanges,\n ]);\n\n yield* Option.match(specResult, {\n onSome: () =>\n Effect.gen(function* () {\n const pendingSize = yield* Queue.size(signal);\n yield* Effect.when(\n Effect.gen(function* () {\n const allChanges = yield* Ref.getAndSet(changesRef, []);\n yield* logChangeReport(allChanges);\n }),\n () => pendingSize === 0,\n );\n }),\n onNone: () => Ref.set(changesRef, []),\n });\n }),\n );\n });\n\nconst loadSpec = Effect.gen(function* () {\n const path = yield* Path.Path;\n const specPathUrl = yield* path.toFileUrl(yield* getSpecPath);\n const specModule = yield* Effect.tryPromise({\n try: () => tsx.tsImport(specPathUrl.href, import.meta.url),\n catch: (error) => new SpecImportFailedError({ error }),\n });\n const spec = specModule.default;\n\n if (Spec.isSpec(spec)) {\n return spec;\n } else {\n return yield* Effect.fail(new SpecFileDoesNotExportSpecError());\n }\n});\n\nconst getSpecPath = Effect.gen(function* () {\n const path = yield* Path.Path;\n const confectDirectory = yield* ConfectDirectory.get;\n\n return path.join(confectDirectory, \"spec.ts\");\n});\n\nconst specFileWatcher = (\n signal: Queue.Queue<void>,\n pendingRef: Ref.Ref<Pending>,\n) =>\n Effect.gen(function* () {\n const specPath = yield* getSpecPath;\n\n const specChanges: Stream.Stream<void> = Stream.asyncPush(\n (emit) =>\n Effect.acquireRelease(\n Effect.promise(async () => {\n const ctx = await esbuild.context({\n entryPoints: [specPath],\n bundle: true,\n write: false,\n metafile: true,\n platform: \"node\",\n format: \"esm\",\n logLevel: \"silent\",\n external: [\n \"@confect/core\",\n \"@confect/server\",\n \"effect\",\n \"@effect/*\",\n ],\n plugins: [\n {\n name: \"notify-rebuild\",\n setup(build) {\n build.onEnd((result) => {\n if (result.errors.length === 0) {\n emit.single();\n } else {\n Effect.runPromise(\n Effect.gen(function* () {\n yield* logFailed(\"Build errors\");\n const formattedMessages = yield* Effect.promise(\n () =>\n esbuild.formatMessages(result.errors, {\n kind: \"error\",\n color: true,\n terminalWidth: 80,\n }),\n );\n const output = formatBuildErrors(\n result.errors,\n formattedMessages,\n );\n yield* Console.error(\"\\n\" + output + \"\\n\");\n }),\n );\n }\n });\n },\n },\n ],\n });\n\n await ctx.watch();\n\n return ctx;\n }),\n (ctx) =>\n Effect.promise(() => ctx.dispose()).pipe(\n Effect.tap(() => Effect.logDebug(\"esbuild watcher disposed\")),\n ),\n ),\n { bufferSize: 1, strategy: \"sliding\" },\n );\n\n yield* pipe(\n specChanges,\n Stream.debounce(Duration.millis(200)),\n Stream.runForEach(() =>\n Ref.update(pendingRef, (pending) => ({\n ...pending,\n specDirty: true,\n })).pipe(Effect.andThen(Queue.offer(signal, undefined))),\n ),\n );\n });\n\nconst formatBuildError = (\n error: esbuild.Message | undefined,\n formattedMessage: string,\n): string => {\n const lines = String.split(formattedMessage, \"\\n\");\n const redErrorText = pipe(\n AnsiDoc.text(error?.text ?? \"\"),\n AnsiDoc.annotate(Ansi.red),\n AnsiDoc.render({ style: \"pretty\" }),\n );\n const replaced = pipe(\n Array.findFirstIndex(lines, (l) => pipe(l, String.trim, String.isNonEmpty)),\n Option.match({\n onNone: () => lines,\n onSome: (idx) => Array.modify(lines, idx, () => redErrorText),\n }),\n );\n return pipe(\n replaced,\n Array.map((l) => (pipe(l, String.trim, String.isNonEmpty) ? ` ${l}` : l)),\n Array.join(\"\\n\"),\n );\n};\n\nconst formatBuildErrors = (\n errors: readonly esbuild.Message[],\n formattedMessages: readonly string[],\n): string =>\n pipe(\n formattedMessages,\n Array.map((message, i) => formatBuildError(errors[i], message)),\n Array.join(\"\"),\n String.trimEnd,\n );\n\nexport class SpecFileDoesNotExportSpecError extends Schema.TaggedError<SpecFileDoesNotExportSpecError>(\n \"SpecFileDoesNotExportSpecError\",\n)(\"SpecFileDoesNotExportSpecError\", {}) {}\n\nexport class SpecImportFailedError extends Schema.TaggedError<SpecImportFailedError>(\n \"SpecImportFailedError\",\n)(\"SpecImportFailedError\", {\n error: Schema.Unknown,\n}) {}\n\nconst syncOptionalFile = (generate: typeof generateHttp, convexFile: string) =>\n pipe(\n generate,\n Effect.andThen(\n Option.match({\n onSome: ({ change, convexFilePath }) =>\n Match.value(change).pipe(\n Match.when(\"Unchanged\", () => Effect.succeed(Option.none())),\n Match.whenOr(\"Added\", \"Modified\", (addedOrModified) =>\n Effect.succeed(\n Option.some(\n FileChange.OptionalFile({\n change: addedOrModified,\n filePath: convexFilePath,\n }),\n ),\n ),\n ),\n Match.exhaustive,\n ),\n onNone: () =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const convexDirectory = yield* ConvexDirectory.get;\n const convexFilePath = path.join(convexDirectory, convexFile);\n\n if (yield* fs.exists(convexFilePath)) {\n yield* fs.remove(convexFilePath);\n\n return Option.some(\n FileChange.OptionalFile({\n change: \"Removed\",\n filePath: convexFilePath,\n }),\n );\n } else {\n return Option.none();\n }\n }),\n }),\n ),\n );\n\nconst optionalConfectFiles: ReadonlyRecord<string, keyof Pending> = {\n \"http.ts\": \"httpDirty\",\n \"app.ts\": \"appDirty\",\n \"crons.ts\": \"cronsDirty\",\n \"auth.ts\": \"authDirty\",\n};\n\nconst confectDirectoryWatcher = (\n signal: Queue.Queue<void>,\n pendingRef: Ref.Ref<Pending>,\n) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const confectDirectory = yield* ConfectDirectory.get;\n\n yield* pipe(\n fs.watch(confectDirectory),\n Stream.runForEach((event) =>\n pipe(\n Option.fromNullable(optionalConfectFiles[event.path]),\n Option.match({\n onNone: () => Effect.void,\n onSome: (pendingKey) =>\n pipe(\n pendingRef,\n Ref.update((pending) => ({\n ...pending,\n [pendingKey]: true,\n })),\n Effect.andThen(Queue.offer(signal, undefined)),\n ),\n }),\n ),\n ),\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;AAiDA,MAAMA,cAAuB;CAC3B,WAAW;CACX,WAAW;CACX,UAAU;CACV,YAAY;CACZ,WAAW;CACZ;AAeD,MAAM,aAAa,KAAK,YAAwB;AAEhD,MAAM,mBAAmB,YACvB,OAAO,IAAI,aAAa;AACtB,QAAO,aAAa,iCAAiC;AAErD,QAAO,OAAO,KACZ,OAAO,QAAQ,UAAU,WACvB,WAAW,OAAO,QAAQ;EACxB,eAAe,EAAE,QAAQ,GAAG,eAC1B,sBAAsB,GAAG,SAAS;EACpC,cAAc,EACZ,QAAQ,GACR,UACA,gBACA,uBAEA,OAAO,IAAI,aAAa;AACtB,UAAO,sBAAsB,GAAG,SAAS;AACzC,UAAO,OAAO,QAAQ,gBAAgB,yBAAyB;AAC/D,UAAO,OAAO,QACZ,kBACA,2BACD;IACD;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Aa,qBAAqB,MAAM,MAAM,EACrD,OAAO,MAAM;EACX,cAAc,OAAO;EACrB,SAAS,eACP,KACE,YACA,IAAI,QAAQ,aAAa;GACvB,GAAG;IACF,aAAa;GACf,EAAE,EACH,OAAO,QAAQ,MAAM,MAAM,QAAQ,OAAU,CAAC,CAC/C;EACJ,CAAC,CACH,CACF,CACF;EACD"}
|
package/dist/confect.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ProjectRoot } from "./services/ProjectRoot.mjs";
|
|
2
|
+
import { ConvexDirectory } from "./services/ConvexDirectory.mjs";
|
|
3
|
+
import { ConfectDirectory } from "./services/ConfectDirectory.mjs";
|
|
4
|
+
import { codegen } from "./confect/codegen.mjs";
|
|
5
|
+
import { dev } from "./confect/dev.mjs";
|
|
6
|
+
import { Layer } from "effect";
|
|
7
|
+
import { Command } from "@effect/cli";
|
|
8
|
+
|
|
9
|
+
//#region src/confect.ts
|
|
10
|
+
const confect = Command.make("confect").pipe(Command.withDescription("Generate and sync Confect files with Convex"), Command.withSubcommands([codegen, dev]), Command.provide(Layer.mergeAll(ConfectDirectory.Default, ProjectRoot.Default, ConvexDirectory.Default)));
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { confect };
|
|
14
|
+
//# sourceMappingURL=confect.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confect.mjs","names":[],"sources":["../src/confect.ts"],"sourcesContent":["import { Command } from \"@effect/cli\";\nimport { Layer } from \"effect\";\nimport { codegen } from \"./confect/codegen\";\nimport { dev } from \"./confect/dev\";\nimport { ConfectDirectory } from \"./services/ConfectDirectory\";\nimport { ConvexDirectory } from \"./services/ConvexDirectory\";\nimport { ProjectRoot } from \"./services/ProjectRoot\";\n\nexport const confect = Command.make(\"confect\").pipe(\n Command.withDescription(\"Generate and sync Confect files with Convex\"),\n Command.withSubcommands([codegen, dev]),\n Command.provide(\n Layer.mergeAll(\n ConfectDirectory.Default,\n ProjectRoot.Default,\n ConvexDirectory.Default,\n ),\n ),\n);\n"],"mappings":";;;;;;;;;AAQA,MAAa,UAAU,QAAQ,KAAK,UAAU,CAAC,KAC7C,QAAQ,gBAAgB,8CAA8C,EACtE,QAAQ,gBAAgB,CAAC,SAAS,IAAI,CAAC,EACvC,QAAQ,QACN,MAAM,SACJ,iBAAiB,SACjB,YAAY,SACZ,gBAAgB,QACjB,CACF,CACF"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { layer } from "./node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeContext.mjs";
|
|
3
|
+
import { runMain } from "./node_modules/.pnpm/@effect_platform-node@0.100.0_@effect_cluster@0.52.9_@effect_platform@0.93.2_effect@3.1_a15ca1802d939cd85cc564105ef862ac/node_modules/@effect/platform-node/dist/esm/NodeRuntime.mjs";
|
|
4
|
+
import { cliApp } from "./cliApp.mjs";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
let interrupted = false;
|
|
9
|
+
process.prependListener("SIGINT", () => {
|
|
10
|
+
interrupted = true;
|
|
11
|
+
});
|
|
12
|
+
process.on("exit", () => {
|
|
13
|
+
if (interrupted) process.kill(process.pid, "SIGINT");
|
|
14
|
+
});
|
|
15
|
+
cliApp(process.argv).pipe(Effect.provide(layer), runMain);
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { };
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["NodeContext.layer","NodeRuntime.runMain"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { NodeContext, NodeRuntime } from \"@effect/platform-node\";\nimport { Effect } from \"effect\";\nimport { cliApp } from \"./cliApp\";\n\n// Track if we received SIGINT so we can re-raise it after cleanup.\n// This ensures proper terminal state restoration when run via e.g. `pnpm`.\nlet interrupted = false;\nprocess.prependListener(\"SIGINT\", () => {\n interrupted = true;\n});\nprocess.on(\"exit\", () => {\n if (interrupted) {\n process.kill(process.pid, \"SIGINT\");\n }\n});\n\ncliApp(process.argv).pipe(\n Effect.provide(NodeContext.layer),\n NodeRuntime.runMain,\n);\n"],"mappings":";;;;;;;AAQA,IAAI,cAAc;AAClB,QAAQ,gBAAgB,gBAAgB;AACtC,eAAc;EACd;AACF,QAAQ,GAAG,cAAc;AACvB,KAAI,YACF,SAAQ,KAAK,QAAQ,KAAK,SAAS;EAErC;AAEF,OAAO,QAAQ,KAAK,CAAC,KACnB,OAAO,QAAQA,MAAkB,EACjCC,QACD"}
|
package/dist/log.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { toString } from "./GroupPath.mjs";
|
|
2
|
+
import { ProjectRoot } from "./services/ProjectRoot.mjs";
|
|
3
|
+
import { Console, Effect, String, pipe } from "effect";
|
|
4
|
+
import { Path } from "@effect/platform";
|
|
5
|
+
import { Ansi, AnsiDoc } from "@effect/printer-ansi";
|
|
6
|
+
|
|
7
|
+
//#region src/log.ts
|
|
8
|
+
const logFile = (char, color) => (fullPath) => Effect.gen(function* () {
|
|
9
|
+
const prefix = (yield* ProjectRoot.get) + (yield* Path.Path).sep;
|
|
10
|
+
const suffix = pipe(fullPath, String.startsWith(prefix)) ? pipe(fullPath, String.slice(prefix.length)) : fullPath;
|
|
11
|
+
yield* Console.log(pipe(AnsiDoc.char(char), AnsiDoc.annotate(color), AnsiDoc.catWithSpace(AnsiDoc.hcat([pipe(AnsiDoc.text(prefix), AnsiDoc.annotate(Ansi.blackBright)), pipe(AnsiDoc.text(suffix), AnsiDoc.annotate(color))])), AnsiDoc.render({ style: "pretty" })));
|
|
12
|
+
});
|
|
13
|
+
const logFileAdded = logFile("+", Ansi.green);
|
|
14
|
+
const logFileRemoved = logFile("-", Ansi.red);
|
|
15
|
+
const logFileModified = logFile("~", Ansi.yellow);
|
|
16
|
+
const logFunction = (char, color) => (functionPath) => Console.log(pipe(AnsiDoc.text(" "), AnsiDoc.cat(pipe(AnsiDoc.char(char), AnsiDoc.annotate(color))), AnsiDoc.catWithSpace(AnsiDoc.hcat([pipe(AnsiDoc.text(toString(functionPath.groupPath) + "."), AnsiDoc.annotate(Ansi.blackBright)), pipe(AnsiDoc.text(functionPath.name), AnsiDoc.annotate(color))])), AnsiDoc.render({ style: "pretty" })));
|
|
17
|
+
const logFunctionAdded = logFunction("+", Ansi.green);
|
|
18
|
+
const logFunctionRemoved = logFunction("-", Ansi.red);
|
|
19
|
+
const logStatus = (char, charColor, messageText, messageColor) => (message) => Console.log(pipe(AnsiDoc.char(char), AnsiDoc.annotate(charColor), AnsiDoc.catWithSpace(pipe(AnsiDoc.char(" "), AnsiDoc.cat(AnsiDoc.text(messageText)), AnsiDoc.cat(AnsiDoc.char(" ")), AnsiDoc.annotate(messageColor))), AnsiDoc.catWithSpace(AnsiDoc.text(message)), AnsiDoc.render({ style: "pretty" })));
|
|
20
|
+
const logCompleted = logStatus("✔︎", Ansi.green, "SUCCESS", Ansi.combine(Ansi.green, Ansi.bgGreenBright));
|
|
21
|
+
const logFailed = logStatus("✘", Ansi.red, "FAILURE", Ansi.combine(Ansi.red, Ansi.bgRedBright));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { logCompleted, logFailed, logFileAdded, logFileModified, logFileRemoved };
|
|
25
|
+
//# sourceMappingURL=log.mjs.map
|
package/dist/log.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.mjs","names":["GroupPath.toString"],"sources":["../src/log.ts"],"sourcesContent":["import { Path } from \"@effect/platform\";\nimport { Ansi, AnsiDoc } from \"@effect/printer-ansi\";\nimport { Console, Effect, pipe, String } from \"effect\";\nimport type * as FunctionPath from \"./FunctionPath\";\nimport * as GroupPath from \"./GroupPath\";\nimport { ProjectRoot } from \"./services/ProjectRoot\";\n\n// --- File operation logs ---\n\nconst logFile = (char: string, color: Ansi.Ansi) => (fullPath: string) =>\n Effect.gen(function* () {\n const projectRoot = yield* ProjectRoot.get;\n const path = yield* Path.Path;\n\n const prefix = projectRoot + path.sep;\n const suffix = pipe(fullPath, String.startsWith(prefix))\n ? pipe(fullPath, String.slice(prefix.length))\n : fullPath;\n\n yield* Console.log(\n pipe(\n AnsiDoc.char(char),\n AnsiDoc.annotate(color),\n AnsiDoc.catWithSpace(\n AnsiDoc.hcat([\n pipe(AnsiDoc.text(prefix), AnsiDoc.annotate(Ansi.blackBright)),\n pipe(AnsiDoc.text(suffix), AnsiDoc.annotate(color)),\n ]),\n ),\n AnsiDoc.render({ style: \"pretty\" }),\n ),\n );\n });\n\nexport const logFileAdded = logFile(\"+\", Ansi.green);\n\nexport const logFileRemoved = logFile(\"-\", Ansi.red);\n\nexport const logFileModified = logFile(\"~\", Ansi.yellow);\n\n// --- Function subline logs ---\n\nconst logFunction =\n (char: string, color: Ansi.Ansi) =>\n (functionPath: FunctionPath.FunctionPath) =>\n Console.log(\n pipe(\n AnsiDoc.text(\" \"),\n AnsiDoc.cat(pipe(AnsiDoc.char(char), AnsiDoc.annotate(color))),\n AnsiDoc.catWithSpace(\n AnsiDoc.hcat([\n pipe(\n AnsiDoc.text(GroupPath.toString(functionPath.groupPath) + \".\"),\n AnsiDoc.annotate(Ansi.blackBright),\n ),\n pipe(AnsiDoc.text(functionPath.name), AnsiDoc.annotate(color)),\n ]),\n ),\n AnsiDoc.render({ style: \"pretty\" }),\n ),\n );\n\nexport const logFunctionAdded = logFunction(\"+\", Ansi.green);\n\nexport const logFunctionRemoved = logFunction(\"-\", Ansi.red);\n\n// --- Process status logs ---\n\nconst logStatus =\n (\n char: string,\n charColor: Ansi.Ansi,\n messageText: string,\n messageColor: Ansi.Ansi,\n ) =>\n (message: string) =>\n Console.log(\n pipe(\n AnsiDoc.char(char),\n AnsiDoc.annotate(charColor),\n AnsiDoc.catWithSpace(\n pipe(\n AnsiDoc.char(\" \"),\n AnsiDoc.cat(AnsiDoc.text(messageText)),\n AnsiDoc.cat(AnsiDoc.char(\" \")),\n AnsiDoc.annotate(messageColor),\n ),\n ),\n AnsiDoc.catWithSpace(AnsiDoc.text(message)),\n AnsiDoc.render({ style: \"pretty\" }),\n ),\n );\n\nexport const logCompleted = logStatus(\n \"✔︎\",\n Ansi.green,\n \"SUCCESS\",\n Ansi.combine(Ansi.green, Ansi.bgGreenBright),\n);\n\nexport const logFailed = logStatus(\n \"✘\",\n Ansi.red,\n \"FAILURE\",\n Ansi.combine(Ansi.red, Ansi.bgRedBright),\n);\n"],"mappings":";;;;;;;AASA,MAAM,WAAW,MAAc,WAAsB,aACnD,OAAO,IAAI,aAAa;CAItB,MAAM,UAHc,OAAO,YAAY,QAC1B,OAAO,KAAK,MAES;CAClC,MAAM,SAAS,KAAK,UAAU,OAAO,WAAW,OAAO,CAAC,GACpD,KAAK,UAAU,OAAO,MAAM,OAAO,OAAO,CAAC,GAC3C;AAEJ,QAAO,QAAQ,IACb,KACE,QAAQ,KAAK,KAAK,EAClB,QAAQ,SAAS,MAAM,EACvB,QAAQ,aACN,QAAQ,KAAK,CACX,KAAK,QAAQ,KAAK,OAAO,EAAE,QAAQ,SAAS,KAAK,YAAY,CAAC,EAC9D,KAAK,QAAQ,KAAK,OAAO,EAAE,QAAQ,SAAS,MAAM,CAAC,CACpD,CAAC,CACH,EACD,QAAQ,OAAO,EAAE,OAAO,UAAU,CAAC,CACpC,CACF;EACD;AAEJ,MAAa,eAAe,QAAQ,KAAK,KAAK,MAAM;AAEpD,MAAa,iBAAiB,QAAQ,KAAK,KAAK,IAAI;AAEpD,MAAa,kBAAkB,QAAQ,KAAK,KAAK,OAAO;AAIxD,MAAM,eACH,MAAc,WACd,iBACC,QAAQ,IACN,KACE,QAAQ,KAAK,KAAK,EAClB,QAAQ,IAAI,KAAK,QAAQ,KAAK,KAAK,EAAE,QAAQ,SAAS,MAAM,CAAC,CAAC,EAC9D,QAAQ,aACN,QAAQ,KAAK,CACX,KACE,QAAQ,KAAKA,SAAmB,aAAa,UAAU,GAAG,IAAI,EAC9D,QAAQ,SAAS,KAAK,YAAY,CACnC,EACD,KAAK,QAAQ,KAAK,aAAa,KAAK,EAAE,QAAQ,SAAS,MAAM,CAAC,CAC/D,CAAC,CACH,EACD,QAAQ,OAAO,EAAE,OAAO,UAAU,CAAC,CACpC,CACF;AAEL,MAAa,mBAAmB,YAAY,KAAK,KAAK,MAAM;AAE5D,MAAa,qBAAqB,YAAY,KAAK,KAAK,IAAI;AAI5D,MAAM,aAEF,MACA,WACA,aACA,kBAED,YACC,QAAQ,IACN,KACE,QAAQ,KAAK,KAAK,EAClB,QAAQ,SAAS,UAAU,EAC3B,QAAQ,aACN,KACE,QAAQ,KAAK,IAAI,EACjB,QAAQ,IAAI,QAAQ,KAAK,YAAY,CAAC,EACtC,QAAQ,IAAI,QAAQ,KAAK,IAAI,CAAC,EAC9B,QAAQ,SAAS,aAAa,CAC/B,CACF,EACD,QAAQ,aAAa,QAAQ,KAAK,QAAQ,CAAC,EAC3C,QAAQ,OAAO,EAAE,OAAO,UAAU,CAAC,CACpC,CACF;AAEL,MAAa,eAAe,UAC1B,MACA,KAAK,OACL,WACA,KAAK,QAAQ,KAAK,OAAO,KAAK,cAAc,CAC7C;AAED,MAAa,YAAY,UACvB,KACA,KAAK,KACL,WACA,KAAK,QAAQ,KAAK,KAAK,KAAK,YAAY,CACzC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { layer as layer$1 } from "./internal/commandExecutor.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @category layer
|
|
7
|
+
*/
|
|
8
|
+
const layer = layer$1;
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { layer };
|
|
12
|
+
//# sourceMappingURL=NodeCommandExecutor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeCommandExecutor.mjs","names":["internal.layer"],"sources":["../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js"],"sourcesContent":["import * as internal from \"./internal/commandExecutor.js\";\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layer = internal.layer;\n//# sourceMappingURL=NodeCommandExecutor.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,MAAa,QAAQA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { layer as layer$1 } from "./internal/fileSystem.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
* @category layer
|
|
10
|
+
*/
|
|
11
|
+
const layer = layer$1;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { layer };
|
|
15
|
+
//# sourceMappingURL=NodeFileSystem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFileSystem.mjs","names":["internal.layer"],"sources":["../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js"],"sourcesContent":["/**\n * @since 1.0.0\n */\nimport * as internal from \"./internal/fileSystem.js\";\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layer = internal.layer;\n//# sourceMappingURL=NodeFileSystem.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAQA,MAAa,QAAQA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { layer as layer$1, layerPosix as layerPosix$1, layerWin32 as layerWin32$1 } from "./internal/path.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
* @category layer
|
|
10
|
+
*/
|
|
11
|
+
const layer = layer$1;
|
|
12
|
+
/**
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
* @category layer
|
|
15
|
+
*/
|
|
16
|
+
const layerPosix = layerPosix$1;
|
|
17
|
+
/**
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
* @category layer
|
|
20
|
+
*/
|
|
21
|
+
const layerWin32 = layerWin32$1;
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { layer };
|
|
25
|
+
//# sourceMappingURL=NodePath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodePath.mjs","names":["internal.layer","internal.layerPosix","internal.layerWin32"],"sources":["../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js"],"sourcesContent":["/**\n * @since 1.0.0\n */\nimport * as internal from \"./internal/path.js\";\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layer = internal.layer;\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layerPosix = internal.layerPosix;\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layerWin32 = internal.layerWin32;\n//# sourceMappingURL=NodePath.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAQA,MAAa,QAAQA;;;;;AAKrB,MAAa,aAAaC;;;;;AAK1B,MAAa,aAAaC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { runMain as runMain$1 } from "./internal/runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.js
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @category runtime
|
|
7
|
+
*/
|
|
8
|
+
const runMain = runMain$1;
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { runMain };
|
|
12
|
+
//# sourceMappingURL=NodeRuntime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeRuntime.mjs","names":["internal.runMain"],"sources":["../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.js"],"sourcesContent":["import * as internal from \"./internal/runtime.js\";\n/**\n * @since 1.0.0\n * @category runtime\n */\nexport const runMain = internal.runMain;\n//# sourceMappingURL=NodeRuntime.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,MAAa,UAAUA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { layer as layer$1, make as make$1 } from "./internal/terminal.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @category constructors
|
|
7
|
+
*/
|
|
8
|
+
const make = make$1;
|
|
9
|
+
/**
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category layer
|
|
12
|
+
*/
|
|
13
|
+
const layer = layer$1;
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { layer };
|
|
17
|
+
//# sourceMappingURL=NodeTerminal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeTerminal.mjs","names":["InternalTerminal.make","InternalTerminal.layer"],"sources":["../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js"],"sourcesContent":["import * as InternalTerminal from \"./internal/terminal.js\";\n/**\n * @since 1.0.0\n * @category constructors\n */\nexport const make = InternalTerminal.make;\n/**\n * @since 1.0.0\n * @category layer\n */\nexport const layer = InternalTerminal.layer;\n//# sourceMappingURL=NodeTerminal.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,MAAa,OAAOA;;;;;AAKpB,MAAa,QAAQC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { handleErrnoException } from "./error.mjs";
|
|
2
|
+
import { fromReadable } from "./stream.mjs";
|
|
3
|
+
import { fromWritable } from "./sink.mjs";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { constUndefined, identity, pipe } from "effect/Function";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as Stream from "effect/Stream";
|
|
9
|
+
import * as Deferred from "effect/Deferred";
|
|
10
|
+
import * as Inspectable from "effect/Inspectable";
|
|
11
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
12
|
+
import * as Sink from "effect/Sink";
|
|
13
|
+
import * as Command from "@effect/platform/Command";
|
|
14
|
+
import * as CommandExecutor from "@effect/platform/CommandExecutor";
|
|
15
|
+
import * as ChildProcess from "node:child_process";
|
|
16
|
+
|
|
17
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
|
|
18
|
+
const inputToStdioOption = (stdin) => typeof stdin === "string" ? stdin : "pipe";
|
|
19
|
+
const outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
|
|
20
|
+
const toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
|
|
21
|
+
const toPlatformError = (method, error, command) => {
|
|
22
|
+
const flattened = Command.flatten(command).reduce((acc, curr) => {
|
|
23
|
+
const command$1 = `${curr.command} ${curr.args.join(" ")}`;
|
|
24
|
+
return acc.length === 0 ? command$1 : `${acc} | ${command$1}`;
|
|
25
|
+
}, "");
|
|
26
|
+
return handleErrnoException("Command", method)(error, [flattened]);
|
|
27
|
+
};
|
|
28
|
+
const ProcessProto = {
|
|
29
|
+
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
|
|
30
|
+
...Inspectable.BaseProto,
|
|
31
|
+
toJSON() {
|
|
32
|
+
return {
|
|
33
|
+
_id: "@effect/platform/CommandExecutor/Process",
|
|
34
|
+
pid: this.pid
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const runCommand = (fileSystem) => (command) => {
|
|
39
|
+
switch (command._tag) {
|
|
40
|
+
case "StandardCommand": {
|
|
41
|
+
const spawn = Effect.flatMap(Deferred.make(), (exitCode) => Effect.async((resume) => {
|
|
42
|
+
const handle = ChildProcess.spawn(command.command, command.args, {
|
|
43
|
+
stdio: [
|
|
44
|
+
inputToStdioOption(command.stdin),
|
|
45
|
+
outputToStdioOption(command.stdout),
|
|
46
|
+
outputToStdioOption(command.stderr)
|
|
47
|
+
],
|
|
48
|
+
cwd: Option.getOrElse(command.cwd, constUndefined),
|
|
49
|
+
shell: command.shell,
|
|
50
|
+
env: {
|
|
51
|
+
...process.env,
|
|
52
|
+
...Object.fromEntries(command.env)
|
|
53
|
+
},
|
|
54
|
+
detached: process.platform !== "win32"
|
|
55
|
+
});
|
|
56
|
+
handle.on("error", (err) => {
|
|
57
|
+
resume(Effect.fail(toPlatformError("spawn", err, command)));
|
|
58
|
+
});
|
|
59
|
+
handle.on("exit", (...args) => {
|
|
60
|
+
Deferred.unsafeDone(exitCode, Effect.succeed(args));
|
|
61
|
+
});
|
|
62
|
+
handle.on("spawn", () => {
|
|
63
|
+
resume(Effect.succeed([handle, exitCode]));
|
|
64
|
+
});
|
|
65
|
+
return Effect.sync(() => {
|
|
66
|
+
handle.kill("SIGTERM");
|
|
67
|
+
});
|
|
68
|
+
}));
|
|
69
|
+
const killProcessGroup = process.platform === "win32" ? (handle, _) => Effect.async((resume) => {
|
|
70
|
+
ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, (error) => {
|
|
71
|
+
if (error) resume(Effect.fail(toPlatformError("kill", toError(error), command)));
|
|
72
|
+
else resume(Effect.void);
|
|
73
|
+
});
|
|
74
|
+
}) : (handle, signal) => Effect.try({
|
|
75
|
+
try: () => process.kill(-handle.pid, signal),
|
|
76
|
+
catch: (error) => toPlatformError("kill", toError(error), command)
|
|
77
|
+
});
|
|
78
|
+
const killProcess = (handle, signal) => Effect.suspend(() => handle.kill(signal) ? Effect.void : Effect.fail(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
|
|
79
|
+
return pipe(Option.match(command.cwd, {
|
|
80
|
+
onNone: () => Effect.void,
|
|
81
|
+
onSome: (dir) => fileSystem.access(dir)
|
|
82
|
+
}), Effect.zipRight(Effect.acquireRelease(spawn, ([handle, exitCode]) => Effect.flatMap(Deferred.isDone(exitCode), (done) => {
|
|
83
|
+
if (!done) return killProcessGroup(handle, "SIGTERM").pipe(Effect.orElse(() => killProcess(handle, "SIGTERM")), Effect.zipRight(Deferred.await(exitCode)), Effect.ignore);
|
|
84
|
+
return Effect.flatMap(Deferred.await(exitCode), ([code]) => {
|
|
85
|
+
if (code !== 0 && code !== null) return killProcessGroup(handle, "SIGTERM").pipe(Effect.ignore);
|
|
86
|
+
return Effect.void;
|
|
87
|
+
});
|
|
88
|
+
}))), Effect.map(([handle, exitCodeDeferred]) => {
|
|
89
|
+
let stdin = Sink.drain;
|
|
90
|
+
if (handle.stdin !== null) stdin = fromWritable(() => handle.stdin, (err) => toPlatformError("toWritable", toError(err), command));
|
|
91
|
+
const exitCode = Effect.flatMap(Deferred.await(exitCodeDeferred), ([code, signal]) => {
|
|
92
|
+
if (code !== null) return Effect.succeed(CommandExecutor.ExitCode(code));
|
|
93
|
+
return Effect.fail(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
|
|
94
|
+
});
|
|
95
|
+
const isRunning = Effect.negate(Deferred.isDone(exitCodeDeferred));
|
|
96
|
+
const kill = (signal = "SIGTERM") => killProcessGroup(handle, signal).pipe(Effect.orElse(() => killProcess(handle, signal)), Effect.zipRight(Effect.asVoid(Deferred.await(exitCodeDeferred))));
|
|
97
|
+
const pid = CommandExecutor.ProcessId(handle.pid);
|
|
98
|
+
const stderr = fromReadable(() => handle.stderr, (err) => toPlatformError("fromReadable(stderr)", toError(err), command));
|
|
99
|
+
let stdout = fromReadable(() => handle.stdout, (err) => toPlatformError("fromReadable(stdout)", toError(err), command));
|
|
100
|
+
if (typeof command.stdout !== "string") stdout = Stream.transduce(stdout, command.stdout);
|
|
101
|
+
return Object.assign(Object.create(ProcessProto), {
|
|
102
|
+
pid,
|
|
103
|
+
exitCode,
|
|
104
|
+
isRunning,
|
|
105
|
+
kill,
|
|
106
|
+
stdin,
|
|
107
|
+
stderr,
|
|
108
|
+
stdout
|
|
109
|
+
});
|
|
110
|
+
}), typeof command.stdin === "string" ? identity : Effect.tap((process$1) => Effect.forkDaemon(Stream.run(command.stdin, process$1.stdin))));
|
|
111
|
+
}
|
|
112
|
+
case "PipedCommand": {
|
|
113
|
+
const flattened = Command.flatten(command);
|
|
114
|
+
if (flattened.length === 1) return pipe(flattened[0], runCommand(fileSystem));
|
|
115
|
+
const head = flattened[0];
|
|
116
|
+
const tail = flattened.slice(1);
|
|
117
|
+
const initial = tail.slice(0, tail.length - 1);
|
|
118
|
+
const last = tail[tail.length - 1];
|
|
119
|
+
const stream = initial.reduce((stdin, command$1) => pipe(Command.stdin(command$1, stdin), runCommand(fileSystem), Effect.map((process$1) => process$1.stdout), Stream.unwrapScoped), pipe(runCommand(fileSystem)(head), Effect.map((process$1) => process$1.stdout), Stream.unwrapScoped));
|
|
120
|
+
return pipe(Command.stdin(last, stream), runCommand(fileSystem));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
/** @internal */
|
|
125
|
+
const layer = /* @__PURE__ */ Layer.effect(CommandExecutor.CommandExecutor, /* @__PURE__ */ pipe(FileSystem.FileSystem, /* @__PURE__ */ Effect.map((fileSystem) => CommandExecutor.makeExecutor(runCommand(fileSystem)))));
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
export { layer };
|
|
129
|
+
//# sourceMappingURL=commandExecutor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.mjs","names":["command","process"],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js"],"sourcesContent":["import * as Command from \"@effect/platform/Command\";\nimport * as CommandExecutor from \"@effect/platform/CommandExecutor\";\nimport * as FileSystem from \"@effect/platform/FileSystem\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport { constUndefined, identity, pipe } from \"effect/Function\";\nimport * as Inspectable from \"effect/Inspectable\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Sink from \"effect/Sink\";\nimport * as Stream from \"effect/Stream\";\nimport * as ChildProcess from \"node:child_process\";\nimport { handleErrnoException } from \"./error.js\";\nimport { fromWritable } from \"./sink.js\";\nimport { fromReadable } from \"./stream.js\";\nconst inputToStdioOption = stdin => typeof stdin === \"string\" ? stdin : \"pipe\";\nconst outputToStdioOption = output => typeof output === \"string\" ? output : \"pipe\";\nconst toError = err => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));\nconst toPlatformError = (method, error, command) => {\n const flattened = Command.flatten(command).reduce((acc, curr) => {\n const command = `${curr.command} ${curr.args.join(\" \")}`;\n return acc.length === 0 ? command : `${acc} | ${command}`;\n }, \"\");\n return handleErrnoException(\"Command\", method)(error, [flattened]);\n};\nconst ProcessProto = {\n [CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"@effect/platform/CommandExecutor/Process\",\n pid: this.pid\n };\n }\n};\nconst runCommand = fileSystem => command => {\n switch (command._tag) {\n case \"StandardCommand\":\n {\n const spawn = Effect.flatMap(Deferred.make(), exitCode => Effect.async(resume => {\n const handle = ChildProcess.spawn(command.command, command.args, {\n stdio: [inputToStdioOption(command.stdin), outputToStdioOption(command.stdout), outputToStdioOption(command.stderr)],\n cwd: Option.getOrElse(command.cwd, constUndefined),\n shell: command.shell,\n env: {\n ...process.env,\n ...Object.fromEntries(command.env)\n },\n detached: process.platform !== \"win32\"\n });\n handle.on(\"error\", err => {\n resume(Effect.fail(toPlatformError(\"spawn\", err, command)));\n });\n handle.on(\"exit\", (...args) => {\n Deferred.unsafeDone(exitCode, Effect.succeed(args));\n });\n handle.on(\"spawn\", () => {\n resume(Effect.succeed([handle, exitCode]));\n });\n return Effect.sync(() => {\n handle.kill(\"SIGTERM\");\n });\n }));\n const killProcessGroup = process.platform === \"win32\" ? (handle, _) => Effect.async(resume => {\n ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, error => {\n if (error) {\n resume(Effect.fail(toPlatformError(\"kill\", toError(error), command)));\n } else {\n resume(Effect.void);\n }\n });\n }) : (handle, signal) => Effect.try({\n try: () => process.kill(-handle.pid, signal),\n catch: error => toPlatformError(\"kill\", toError(error), command)\n });\n const killProcess = (handle, signal) => Effect.suspend(() => handle.kill(signal) ? Effect.void : Effect.fail(toPlatformError(\"kill\", new globalThis.Error(\"Failed to kill process\"), command)));\n return pipe(\n // Validate that the directory is accessible\n Option.match(command.cwd, {\n onNone: () => Effect.void,\n onSome: dir => fileSystem.access(dir)\n }), Effect.zipRight(Effect.acquireRelease(spawn, ([handle, exitCode]) => Effect.flatMap(Deferred.isDone(exitCode), done => {\n if (!done) {\n // Process is still running, kill it\n return killProcessGroup(handle, \"SIGTERM\").pipe(Effect.orElse(() => killProcess(handle, \"SIGTERM\")), Effect.zipRight(Deferred.await(exitCode)), Effect.ignore);\n }\n // Process has already exited, check if we need to clean up children\n return Effect.flatMap(Deferred.await(exitCode), ([code]) => {\n if (code !== 0 && code !== null) {\n // Non-zero exit code, attempt to clean up process group\n return killProcessGroup(handle, \"SIGTERM\").pipe(Effect.ignore);\n }\n return Effect.void;\n });\n }))), Effect.map(([handle, exitCodeDeferred]) => {\n let stdin = Sink.drain;\n if (handle.stdin !== null) {\n stdin = fromWritable(() => handle.stdin, err => toPlatformError(\"toWritable\", toError(err), command));\n }\n const exitCode = Effect.flatMap(Deferred.await(exitCodeDeferred), ([code, signal]) => {\n if (code !== null) {\n return Effect.succeed(CommandExecutor.ExitCode(code));\n }\n // If code is `null`, then `signal` must be defined. See the NodeJS\n // documentation for the `\"exit\"` event on a `child_process`.\n // https://nodejs.org/api/child_process.html#child_process_event_exit\n return Effect.fail(toPlatformError(\"exitCode\", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));\n });\n const isRunning = Effect.negate(Deferred.isDone(exitCodeDeferred));\n const kill = (signal = \"SIGTERM\") => killProcessGroup(handle, signal).pipe(Effect.orElse(() => killProcess(handle, signal)), Effect.zipRight(Effect.asVoid(Deferred.await(exitCodeDeferred))));\n const pid = CommandExecutor.ProcessId(handle.pid);\n const stderr = fromReadable(() => handle.stderr, err => toPlatformError(\"fromReadable(stderr)\", toError(err), command));\n let stdout = fromReadable(() => handle.stdout, err => toPlatformError(\"fromReadable(stdout)\", toError(err), command));\n // TODO: add Sink.isSink\n if (typeof command.stdout !== \"string\") {\n stdout = Stream.transduce(stdout, command.stdout);\n }\n return Object.assign(Object.create(ProcessProto), {\n pid,\n exitCode,\n isRunning,\n kill,\n stdin,\n stderr,\n stdout\n });\n }), typeof command.stdin === \"string\" ? identity : Effect.tap(process => Effect.forkDaemon(Stream.run(command.stdin, process.stdin))));\n }\n case \"PipedCommand\":\n {\n const flattened = Command.flatten(command);\n if (flattened.length === 1) {\n return pipe(flattened[0], runCommand(fileSystem));\n }\n const head = flattened[0];\n const tail = flattened.slice(1);\n const initial = tail.slice(0, tail.length - 1);\n const last = tail[tail.length - 1];\n const stream = initial.reduce((stdin, command) => pipe(Command.stdin(command, stdin), runCommand(fileSystem), Effect.map(process => process.stdout), Stream.unwrapScoped), pipe(runCommand(fileSystem)(head), Effect.map(process => process.stdout), Stream.unwrapScoped));\n return pipe(Command.stdin(last, stream), runCommand(fileSystem));\n }\n }\n};\n/** @internal */\nexport const layer = /*#__PURE__*/Layer.effect(CommandExecutor.CommandExecutor, /*#__PURE__*/pipe(FileSystem.FileSystem, /*#__PURE__*/Effect.map(fileSystem => CommandExecutor.makeExecutor(runCommand(fileSystem)))));\n//# sourceMappingURL=commandExecutor.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAqB,UAAS,OAAO,UAAU,WAAW,QAAQ;AACxE,MAAM,uBAAsB,WAAU,OAAO,WAAW,WAAW,SAAS;AAC5E,MAAM,WAAU,QAAO,eAAe,WAAW,QAAQ,MAAM,IAAI,WAAW,MAAM,OAAO,IAAI,CAAC;AAChG,MAAM,mBAAmB,QAAQ,OAAO,YAAY;CAClD,MAAM,YAAY,QAAQ,QAAQ,QAAQ,CAAC,QAAQ,KAAK,SAAS;EAC/D,MAAMA,YAAU,GAAG,KAAK,QAAQ,GAAG,KAAK,KAAK,KAAK,IAAI;AACtD,SAAO,IAAI,WAAW,IAAIA,YAAU,GAAG,IAAI,KAAKA;IAC/C,GAAG;AACN,QAAO,qBAAqB,WAAW,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;;AAEpE,MAAM,eAAe;EAClB,gBAAgB,gBAAgB,gBAAgB;CACjD,GAAG,YAAY;CACf,SAAS;AACP,SAAO;GACL,KAAK;GACL,KAAK,KAAK;GACX;;CAEJ;AACD,MAAM,cAAa,gBAAc,YAAW;AAC1C,SAAQ,QAAQ,MAAhB;EACE,KAAK,mBACH;GACE,MAAM,QAAQ,OAAO,QAAQ,SAAS,MAAM,GAAE,aAAY,OAAO,OAAM,WAAU;IAC/E,MAAM,SAAS,aAAa,MAAM,QAAQ,SAAS,QAAQ,MAAM;KAC/D,OAAO;MAAC,mBAAmB,QAAQ,MAAM;MAAE,oBAAoB,QAAQ,OAAO;MAAE,oBAAoB,QAAQ,OAAO;MAAC;KACpH,KAAK,OAAO,UAAU,QAAQ,KAAK,eAAe;KAClD,OAAO,QAAQ;KACf,KAAK;MACH,GAAG,QAAQ;MACX,GAAG,OAAO,YAAY,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AAQ,QAAQ,OAAO;AAEnD,WAAO,OAAO,OAAO,OAAO,OAAO,aAAa,EAAE;KAChD;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CAAC;KACF,EAAE,OAAO,QAAQ,UAAU,WAAW,WAAW,OAAO,KAAI,cAAW,OAAO,WAAW,OAAO,IAAI,QAAQ,OAAOC,UAAQ,MAAM,CAAC,CAAC,CAAC;;EAE1I,KAAK,gBACH;GACE,MAAM,YAAY,QAAQ,QAAQ,QAAQ;AAC1C,OAAI,UAAU,WAAW,EACvB,QAAO,KAAK,UAAU,IAAI,WAAW,WAAW,CAAC;GAEnD,MAAM,OAAO,UAAU;GACvB,MAAM,OAAO,UAAU,MAAM,EAAE;GAC/B,MAAM,UAAU,KAAK,MAAM,GAAG,KAAK,SAAS,EAAE;GAC9C,MAAM,OAAO,KAAK,KAAK,SAAS;GAChC,MAAM,SAAS,QAAQ,QAAQ,OAAO,cAAY,KAAK,QAAQ,MAAMD,WAAS,MAAM,EAAE,WAAW,WAAW,EAAE,OAAO,KAAI,cAAWC,UAAQ,OAAO,EAAE,OAAO,aAAa,EAAE,KAAK,WAAW,WAAW,CAAC,KAAK,EAAE,OAAO,KAAI,cAAWA,UAAQ,OAAO,EAAE,OAAO,aAAa,CAAC;AAC1Q,UAAO,KAAK,QAAQ,MAAM,MAAM,OAAO,EAAE,WAAW,WAAW,CAAC;;;;;AAKxE,MAAa,QAAqB,sBAAM,OAAO,gBAAgB,iBAA8B,qBAAK,WAAW,YAAyB,uBAAO,KAAI,eAAc,gBAAgB,aAAa,WAAW,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SystemError } from "@effect/platform/Error";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
|
|
4
|
+
/** @internal */
|
|
5
|
+
const handleErrnoException = (module, method) => (err, [path]) => {
|
|
6
|
+
let reason = "Unknown";
|
|
7
|
+
switch (err.code) {
|
|
8
|
+
case "ENOENT":
|
|
9
|
+
reason = "NotFound";
|
|
10
|
+
break;
|
|
11
|
+
case "EACCES":
|
|
12
|
+
reason = "PermissionDenied";
|
|
13
|
+
break;
|
|
14
|
+
case "EEXIST":
|
|
15
|
+
reason = "AlreadyExists";
|
|
16
|
+
break;
|
|
17
|
+
case "EISDIR":
|
|
18
|
+
reason = "BadResource";
|
|
19
|
+
break;
|
|
20
|
+
case "ENOTDIR":
|
|
21
|
+
reason = "BadResource";
|
|
22
|
+
break;
|
|
23
|
+
case "EBUSY":
|
|
24
|
+
reason = "Busy";
|
|
25
|
+
break;
|
|
26
|
+
case "ELOOP":
|
|
27
|
+
reason = "BadResource";
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
return new SystemError({
|
|
31
|
+
reason,
|
|
32
|
+
module,
|
|
33
|
+
method,
|
|
34
|
+
pathOrDescriptor: path,
|
|
35
|
+
syscall: err.syscall,
|
|
36
|
+
description: err.message,
|
|
37
|
+
cause: err
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { handleErrnoException };
|
|
43
|
+
//# sourceMappingURL=error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@effect+platform-node-shared@0.53.0_@effect+cluster@0.52.9_@effect+platform@0.93.2_effe_e0eeb3aae5ffec3060feb87d17ffb17c/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js"],"sourcesContent":["import { SystemError } from \"@effect/platform/Error\";\n/** @internal */\nexport const handleErrnoException = (module, method) => (err, [path]) => {\n let reason = \"Unknown\";\n switch (err.code) {\n case \"ENOENT\":\n reason = \"NotFound\";\n break;\n case \"EACCES\":\n reason = \"PermissionDenied\";\n break;\n case \"EEXIST\":\n reason = \"AlreadyExists\";\n break;\n case \"EISDIR\":\n reason = \"BadResource\";\n break;\n case \"ENOTDIR\":\n reason = \"BadResource\";\n break;\n case \"EBUSY\":\n reason = \"Busy\";\n break;\n case \"ELOOP\":\n reason = \"BadResource\";\n break;\n }\n return new SystemError({\n reason,\n module,\n method,\n pathOrDescriptor: path,\n syscall: err.syscall,\n description: err.message,\n cause: err\n });\n};\n//# sourceMappingURL=error.js.map"],"x_google_ignoreList":[0],"mappings":";;;;AAEA,MAAa,wBAAwB,QAAQ,YAAY,KAAK,CAAC,UAAU;CACvE,IAAI,SAAS;AACb,SAAQ,IAAI,MAAZ;EACE,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;EACF,KAAK;AACH,YAAS;AACT;;AAEJ,QAAO,IAAI,YAAY;EACrB;EACA;EACA;EACA,kBAAkB;EAClB,SAAS,IAAI;EACb,aAAa,IAAI;EACjB,OAAO;EACR,CAAC"}
|