@r_masseater/msch 0.71.0 → 0.73.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/dist/changed.mjs +5 -4
- package/dist/changed.mjs.map +1 -1
- package/dist/cli.mjs +163 -267
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-TN74hRYq.mjs → define-lint-preset-Bawe3IU5.mjs} +6 -1
- package/dist/define-lint-preset-Bawe3IU5.mjs.map +1 -0
- package/dist/{dependencies-C3kCe35Q.mjs → dependencies-BAjtDvY4.mjs} +27 -55
- package/dist/dependencies-BAjtDvY4.mjs.map +1 -0
- package/dist/exits.mjs +3 -3
- package/dist/exits.mjs.map +1 -1
- package/dist/{index-CWZNFtdG.d.mts → index-CHxAqDok.d.mts} +3 -6
- package/dist/{index-BvxWopv8.d.mts → index-DEuWKkok.d.mts} +2 -1
- package/dist/lint-rules.mjs +18 -2
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/{lookup-report-D1VTEK5k.mjs → lookup-report-Dp36RBaW.mjs} +2 -2
- package/dist/{lookup-report-D1VTEK5k.mjs.map → lookup-report-Dp36RBaW.mjs.map} +1 -1
- package/dist/{manifest-texts-K650kDy8.mjs → manifest-texts-CfnH7ifu.mjs} +4 -6
- package/dist/manifest-texts-CfnH7ifu.mjs.map +1 -0
- package/dist/output-DrM4OsOJ.mjs +14 -0
- package/dist/output-DrM4OsOJ.mjs.map +1 -0
- package/dist/{pass-records-kbx5VgwI.mjs → pass-records-DylVXWk1.mjs} +5 -4
- package/dist/pass-records-DylVXWk1.mjs.map +1 -0
- package/dist/publish.mjs +81 -151
- package/dist/publish.mjs.map +1 -1
- package/dist/{published-CpfXkChq.mjs → published-Bj0gR5IF.mjs} +27 -91
- package/dist/published-Bj0gR5IF.mjs.map +1 -0
- package/dist/published.mjs +11 -11
- package/dist/published.mjs.map +1 -1
- package/dist/refs.mjs +3 -3
- package/dist/refs.mjs.map +1 -1
- package/dist/runtime-Q9CzisOt.mjs +40 -0
- package/dist/runtime-Q9CzisOt.mjs.map +1 -0
- package/dist/wake.mjs +2 -2
- package/dist/wake.mjs.map +1 -1
- package/dist/workspace-manifest-CAVYfp66.mjs +8 -0
- package/dist/workspace-manifest-CAVYfp66.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +8 -6
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +9 -6
- package/dist/define-lint-preset-TN74hRYq.mjs.map +0 -1
- package/dist/dependencies-C3kCe35Q.mjs.map +0 -1
- package/dist/export-subpaths-D6ZLYZGy.mjs +0 -17
- package/dist/export-subpaths-D6ZLYZGy.mjs.map +0 -1
- package/dist/manifest-texts-K650kDy8.mjs.map +0 -1
- package/dist/pass-records-kbx5VgwI.mjs.map +0 -1
- package/dist/published-CpfXkChq.mjs.map +0 -1
- package/dist/runtime-1exMm81b.mjs +0 -45
- package/dist/runtime-1exMm81b.mjs.map +0 -1
- package/dist/workspace-manifest-BC-1cRIJ.mjs +0 -20
- package/dist/workspace-manifest-BC-1cRIJ.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass-records-DylVXWk1.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","Arr","Str","Arr"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/pass-records.ts"],"sourcesContent":["import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\nexport type Value = string | number;\n\nexport interface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nexport const literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nexport const literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nexport const schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nexport const finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nexport const vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nexport const isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nexport const sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n carriesTag,\n declaresAType,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n readonly typeNames: readonly string[];\n readonly tagNames: readonly string[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [], typeNames: [], tagNames: [] };\n\nexport const isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { ...EMPTY_INDEX, vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n ...EMPTY_INDEX,\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n typeNames: pipe(\n indexes,\n Arr.flatMap((index) => index.typeNames),\n ),\n tagNames: pipe(\n indexes,\n Arr.flatMap((index) => index.tagNames),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n Arr.some(declarationsOf(symbol), isModuleDeclaration);\n\nconst typeNameIndex = (visit: Visit, symbol: TypeSymbol): LibraryIndex => {\n const declarations = declarationsOf(symbol);\n const typeNames = pipe(\n [visit.exported.name],\n Arr.filter(() => declaresAType(declarations)),\n );\n const tagNames = pipe(\n typeNames,\n Arr.filter((name) => carriesTag(name)(declarations)),\n );\n return { ...EMPTY_INDEX, typeNames, tagNames };\n};\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([\n declaredTypeIndex(walk, named),\n schemaValueIndex(walk, named),\n typeNameIndex(visit, symbol),\n ]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nexport const libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nexport const annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/kestrion\";\nimport { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, PACKAGE_JSON_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nexport const withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nexport const mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), {\n concurrency: 1,\n });\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/kestrion\";\nimport { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport { readManifest, workspaceDependencies } from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (\n parent !== directory &&\n !(yield* files.exists(files.join(directory, PACKAGE_JSON_FILE)))\n ) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* Effect.forEach(\n names,\n (name) => files.realPath(files.join(directory, NODE_MODULES, name)),\n {\n concurrency: 1,\n },\n );\n});\n\nexport const workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(\n start: string,\n) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }),\n );\n return Arr.flatten(nested);\n});\n\nexport const installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* Effect.forEach(\n names,\n (name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n { concurrency: 1 },\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* Effect.forEach(\n Arr.dedupe([root, ...directories]),\n (directory) => installedPackages(root, directory),\n { concurrency: 1 },\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst PASSED = \"\";\nconst UNREADABLE = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nexport interface Records {\n readonly directory: string;\n readonly passed: readonly string[];\n}\n\nexport type NamedFile = readonly [name: string, file: string];\n\nexport const contentKey = Effect.fn(\"contentKey\")(function* contentKey(\n salt: readonly string[],\n named: readonly NamedFile[],\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* Effect.forEach(\n named,\n ([name, file]) =>\n files\n .hashFile(file)\n .pipe(\n Effect.map(\n (found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`,\n ),\n ),\n { concurrency: 1 },\n );\n return yield* files.hash(Arr.join([...salt, ...entries], LINE_SEPARATOR));\n});\n\nexport const recordsIn = Effect.fn(\"recordsIn\")(function* recordsIn(directory: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.readDirectory(directory);\n return { directory, passed: present } satisfies Records;\n});\n\nexport const keepOnly = Effect.fn(\"keepOnly\")(function* keepOnly(\n records: Records,\n keys: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const stale = pipe(\n records.passed,\n Arr.filter((key) => !Arr.contains(keys, key)),\n );\n yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {\n concurrency: 1,\n discard: true,\n });\n yield* Effect.forEach(\n keys,\n (key) => files.writeFile(files.join(records.directory, key), PASSED),\n { concurrency: 1, discard: true },\n );\n});\n"],"mappings":";;;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CAC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OAAO,GAAG,YAAY,CAAC,CAAC,UAAU,WAC1D,MACA,OACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,UAAU,OAAO,OAAO,QAC5B,QACC,CAAC,MAAM,UACN,MACG,SAAS,IAAI,CAAC,CACd,KACC,OAAO,KACJ,UAAU,GAAG,OAAO,kBAAkB,OAAO,UAAU,aAAa,UAAU,GACjF,CACF,GACJ,EAAE,aAAa,EAAE,CACnB;CACA,OAAO,OAAO,MAAM,KAAKE,MAAI,KAAK,CAAC,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CAAC;AAC1E,CAAC;AAED,MAAa,YAAY,OAAO,GAAG,WAAW,CAAC,CAAC,UAAU,UAAU,WAAmB;CAGrF,OAAO;EAAE;EAAW,QAAQ,QADL,OADF,gBAAA,CACQ,cAAc,SAAS;CAChB;AACtC,CAAC;AAED,MAAa,WAAW,OAAO,GAAG,UAAU,CAAC,CAAC,UAAU,SACtD,SACA,MACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,QAAQ,KACZ,QAAQ,QACRA,MAAI,QAAQ,QAAQ,CAACA,MAAI,SAAS,MAAM,GAAG,CAAC,CAC9C;CACA,OAAO,OAAO,QAAQ,QAAQ,QAAQ,MAAM,WAAW,MAAM,KAAK,QAAQ,WAAW,GAAG,CAAC,GAAG;EAC1F,aAAa;EACb,SAAS;CACX,CAAC;CACD,OAAO,OAAO,QACZ,OACC,QAAQ,MAAM,UAAU,MAAM,KAAK,QAAQ,WAAW,GAAG,GAAG,MAAM,GACnE;EAAE,aAAa;EAAG,SAAS;CAAK,CAClC;AACF,CAAC"}
|
package/dist/publish.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runCli } from "./runtime-
|
|
3
|
-
import { n as importSpecifierOf, t as exportEntriesOf } from "./export-subpaths-D6ZLYZGy.mjs";
|
|
2
|
+
import { t as runCli } from "./runtime-Q9CzisOt.mjs";
|
|
4
3
|
import { i as writeOutputs, n as actionsOidcToken, r as mask, t as BROKER } from "./credential-broker-9FMyTp1H.mjs";
|
|
5
4
|
import { Array, Config, Console, Duration, Effect, FileSystem, Option, Order, Path, Predicate, Record, Schedule, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
6
5
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
+
import { PACKAGE_JSON_FILE, ROOT_SUBPATH, exportEntriesOf, importSpecifierOf, runtimeDependencyNames, unscopedNameOf } from "@r_masseater/kestrion";
|
|
7
|
+
import { decodePackageJson, readPackageJson, readRawPackageJson, readVersionedPackageJson, updatePackageJson, writePackageJson } from "@r_masseater/kestrion/npm";
|
|
7
8
|
import semver from "semver";
|
|
8
9
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
|
|
9
10
|
import { Base64 } from "effect/encoding";
|
|
@@ -51,16 +52,9 @@ const mustSucceed = mustSucceedWith;
|
|
|
51
52
|
const outputOf = outputWith;
|
|
52
53
|
// src/features/publish-workspace/model/export-targets.ts
|
|
53
54
|
const PATTERN$1 = "*";
|
|
54
|
-
const MANIFEST_FILE$4 = "package.json";
|
|
55
55
|
const taggedError$3 = Schema.TaggedError;
|
|
56
56
|
/** @internal */
|
|
57
57
|
var MissingExportTargets = class extends taggedError$3()("MissingExportTargets", { message: Schema.String }) {};
|
|
58
|
-
const AnyExports = Schema.optionalKey(Schema.Unknown);
|
|
59
|
-
const PublishConfig$1 = Schema.Struct({ exports: AnyExports });
|
|
60
|
-
const PublishedExports = Schema.fromJsonString(Schema.Struct({
|
|
61
|
-
exports: AnyExports,
|
|
62
|
-
publishConfig: Schema.optionalKey(PublishConfig$1)
|
|
63
|
-
}));
|
|
64
58
|
const singleTarget = (target) => {
|
|
65
59
|
if (String$1.includes(PATTERN$1)(target)) return [];
|
|
66
60
|
return [target];
|
|
@@ -85,7 +79,7 @@ const missingMessage = (missing) => `The published exports point to files the bu
|
|
|
85
79
|
const checkExportTargets = Effect.fn("publish.checkExportTargets")(function* checkExportTargets(directory) {
|
|
86
80
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
87
81
|
const path = yield* Path.Path;
|
|
88
|
-
const manifest = yield*
|
|
82
|
+
const manifest = yield* readPackageJson(directory);
|
|
89
83
|
const missing = yield* Effect.filter(exportTargetsOf(publishedExportsOf(manifest)), (target) => Effect.map(fileSystem.exists(path.join(directory, target)), (found) => !found));
|
|
90
84
|
return yield* pipe(missing, Array.match({
|
|
91
85
|
onEmpty: () => Effect.void,
|
|
@@ -103,32 +97,6 @@ const TYPES = "types";
|
|
|
103
97
|
const taggedError$2 = Schema.TaggedError;
|
|
104
98
|
/** @internal */
|
|
105
99
|
var IncompatiblePackage = class extends taggedError$2()("IncompatiblePackage", { message: Schema.String }) {};
|
|
106
|
-
const Declared = Schema.Record(Schema.String, Schema.String);
|
|
107
|
-
const VitePlusManifestJson = Schema.fromJsonString(Schema.Struct({ dependencies: Schema.optionalKey(Declared) }));
|
|
108
|
-
const Bin = Schema.Union([Schema.String, Declared]);
|
|
109
|
-
const Native$1 = Schema.Struct({
|
|
110
|
-
binary: Schema.String,
|
|
111
|
-
targets: Schema.Array(Schema.String)
|
|
112
|
-
});
|
|
113
|
-
const Engines = Schema.Struct({ node: Schema.optionalKey(Schema.String) });
|
|
114
|
-
const PublishConfig = Schema.Struct({
|
|
115
|
-
exports: Schema.optionalKey(Schema.Unknown),
|
|
116
|
-
bin: Schema.optionalKey(Bin)
|
|
117
|
-
});
|
|
118
|
-
/** @internal */
|
|
119
|
-
const CompatManifestJson = Schema.fromJsonString(Schema.Struct({
|
|
120
|
-
name: Schema.String,
|
|
121
|
-
version: Schema.String,
|
|
122
|
-
private: Schema.optionalKey(Schema.Boolean),
|
|
123
|
-
native: Schema.optionalKey(Native$1),
|
|
124
|
-
exports: Schema.optionalKey(Schema.Unknown),
|
|
125
|
-
bin: Schema.optionalKey(Bin),
|
|
126
|
-
dependencies: Schema.optionalKey(Declared),
|
|
127
|
-
optionalDependencies: Schema.optionalKey(Declared),
|
|
128
|
-
engines: Schema.optionalKey(Engines),
|
|
129
|
-
peerDependencies: Schema.optionalKey(Declared),
|
|
130
|
-
publishConfig: Schema.optionalKey(PublishConfig)
|
|
131
|
-
}));
|
|
132
100
|
const lowestOf = (range) => pipe(Option.fromNullishOr(semver.validRange(range)), Option.flatMap(() => Option.fromNullishOr(semver.minVersion(range))), Option.map(({ version }) => version));
|
|
133
101
|
const floorOf = (version) => {
|
|
134
102
|
if (semver.prerelease(version) !== null) return version;
|
|
@@ -148,18 +116,27 @@ const withoutViteOfVitePlus = (peers) => {
|
|
|
148
116
|
return peers;
|
|
149
117
|
};
|
|
150
118
|
/** @internal */
|
|
151
|
-
const viteAliasOf = (vitePlusManifest) => pipe(
|
|
119
|
+
const viteAliasOf = (vitePlusManifest) => pipe(decodePackageJson(vitePlusManifest), Option.flatMapNullishOr(({ dependencies }) => dependencies), Option.flatMap(Record.get(VITE)), Option.map((spec) => `${VITE}@${spec}`));
|
|
152
120
|
const casesOf = (manifest, floor) => {
|
|
153
121
|
const declared = withoutViteOfVitePlus(manifest.peerDependencies ?? {});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
122
|
+
const latest = `^${String(semver.major(floor))}`;
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
label: "floor",
|
|
126
|
+
node: floorOf(floor),
|
|
127
|
+
peers: floorPeers(declared)
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: "latest",
|
|
131
|
+
node: latest,
|
|
132
|
+
peers: declared
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: "npx",
|
|
136
|
+
node: latest,
|
|
137
|
+
peers: {}
|
|
138
|
+
}
|
|
139
|
+
];
|
|
163
140
|
};
|
|
164
141
|
/** @internal */
|
|
165
142
|
const compatCasesOf = (manifest) => pipe(nodeFloorOf(manifest), Option.match({
|
|
@@ -169,8 +146,8 @@ const compatCasesOf = (manifest) => pipe(nodeFloorOf(manifest), Option.match({
|
|
|
169
146
|
const isTypesOnly = (target) => Predicate.isReadonlyObject(target) && pipe(Record.keys(target), Array.every((key) => key === TYPES));
|
|
170
147
|
const exportedSubpaths = (exports) => pipe(exportEntriesOf(exports), Array.filter(([subpath, target]) => subpath !== PACKAGE_JSON_EXPORT && !String$1.includes(PATTERN)(subpath) && !isTypesOnly(target)), Array.map(([subpath]) => subpath));
|
|
171
148
|
const subpathsOf = foldExports({
|
|
172
|
-
string: () => [
|
|
173
|
-
array: () => [
|
|
149
|
+
string: () => [ROOT_SUBPATH],
|
|
150
|
+
array: () => [ROOT_SUBPATH],
|
|
174
151
|
object: exportedSubpaths,
|
|
175
152
|
other: () => []
|
|
176
153
|
});
|
|
@@ -189,13 +166,6 @@ const smokeTargetsOf = (manifest) => {
|
|
|
189
166
|
bins: binFilesOf(bin)
|
|
190
167
|
};
|
|
191
168
|
};
|
|
192
|
-
/** @internal */
|
|
193
|
-
const compatManifestIn = Effect.fn("compat.manifestIn")(function* compatManifestIn(directory) {
|
|
194
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
195
|
-
const path = yield* Path.Path;
|
|
196
|
-
const text = yield* fileSystem.readFileString(path.join(directory, "package.json"));
|
|
197
|
-
return yield* Schema.decodeEffect(CompatManifestJson)(text);
|
|
198
|
-
});
|
|
199
169
|
// src/features/publish-workspace/model/platforms.ts
|
|
200
170
|
const RUNNERS = {
|
|
201
171
|
linux: "ubuntu-latest",
|
|
@@ -254,7 +224,6 @@ const nativeReadme = ({ name, target }) => `# ${name}-${target}\n\nThe prebuilt
|
|
|
254
224
|
// src/features/publish-workspace/model/native-package.ts
|
|
255
225
|
const NPM_DIR = "npm";
|
|
256
226
|
const NATIVE_DIR = "native";
|
|
257
|
-
const MANIFEST_FILE$3 = "package.json";
|
|
258
227
|
const KEPT_FIELDS = [
|
|
259
228
|
"license",
|
|
260
229
|
"repository",
|
|
@@ -262,14 +231,9 @@ const KEPT_FIELDS = [
|
|
|
262
231
|
"bugs",
|
|
263
232
|
"engines"
|
|
264
233
|
];
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
269
|
-
const path = yield* Path.Path;
|
|
270
|
-
const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$3));
|
|
271
|
-
const raw = yield* Schema.decodeEffect(PackageJson)(text);
|
|
272
|
-
return pipe(raw, Record.filter((_value, key) => Array.contains(KEPT_FIELDS, key)));
|
|
234
|
+
const keptFields = Effect.fn("keptFields")(function* keptFields(directory) {
|
|
235
|
+
const fields = yield* readRawPackageJson(directory);
|
|
236
|
+
return pipe(fields, Record.filter((_value, key) => Array.contains(KEPT_FIELDS, key)));
|
|
273
237
|
});
|
|
274
238
|
/** @internal */
|
|
275
239
|
const writeNative = Effect.fn("publish.writeNative")(function* writeNative(directory, native) {
|
|
@@ -280,11 +244,10 @@ const writeNative = Effect.fn("publish.writeNative")(function* writeNative(direc
|
|
|
280
244
|
const file = nativeFileOf(native);
|
|
281
245
|
yield* fileSystem.makeDirectory(target, { recursive: true });
|
|
282
246
|
yield* fileSystem.copyFile(path.join(directory, NATIVE_DIR, file), path.join(target, file));
|
|
283
|
-
|
|
247
|
+
yield* Effect.all([writePackageJson(target, {
|
|
284
248
|
...kept,
|
|
285
249
|
...nativeFields(native)
|
|
286
|
-
});
|
|
287
|
-
yield* Effect.all([fileSystem.writeFileString(path.join(target, MANIFEST_FILE$3), text), fileSystem.writeFileString(path.join(target, "README.md"), nativeReadme(native))], { concurrency: "unbounded" });
|
|
250
|
+
}), fileSystem.writeFileString(path.join(target, "README.md"), nativeReadme(native))], { concurrency: "unbounded" });
|
|
288
251
|
return target;
|
|
289
252
|
});
|
|
290
253
|
// src/features/publish-workspace/model/widened-ranges.ts
|
|
@@ -359,18 +322,13 @@ const nativeTarballs = Effect.fn("compat.native")(function* nativeTarballs(direc
|
|
|
359
322
|
}));
|
|
360
323
|
});
|
|
361
324
|
// src/features/publish-workspace/model/compat-workspace.ts
|
|
362
|
-
const dependencyNamesOf = (manifest) => pipe([
|
|
363
|
-
manifest.dependencies,
|
|
364
|
-
manifest.peerDependencies,
|
|
365
|
-
manifest.optionalDependencies
|
|
366
|
-
], Array.flatMap((declared) => Record.keys(declared ?? {})));
|
|
367
325
|
const closureOf = (known, names, seen) => {
|
|
368
326
|
const [name, ...rest] = names;
|
|
369
327
|
if (Predicate.isUndefined(name)) return seen;
|
|
370
328
|
const found = Record.get(known, name);
|
|
371
329
|
const reached = pipe(seen, Array.some((item) => item.manifest.name === name));
|
|
372
330
|
if (Option.isNone(found) || reached) return closureOf(known, rest, seen);
|
|
373
|
-
const inner = closureOf(known,
|
|
331
|
+
const inner = closureOf(known, runtimeDependencyNames(found.value.manifest), [...seen, found.value]);
|
|
374
332
|
return closureOf(known, rest, inner);
|
|
375
333
|
};
|
|
376
334
|
const workspacesBeside = Effect.fn("compat.workspaces")(function* workspacesBeside(directory) {
|
|
@@ -378,7 +336,7 @@ const workspacesBeside = Effect.fn("compat.workspaces")(function* workspacesBesi
|
|
|
378
336
|
const path = yield* Path.Path;
|
|
379
337
|
const parent = path.dirname(path.resolve(directory));
|
|
380
338
|
const entries = yield* fileSystem.readDirectory(parent);
|
|
381
|
-
const found = yield* Effect.forEach(entries, (entry) =>
|
|
339
|
+
const found = yield* Effect.forEach(entries, (entry) => readVersionedPackageJson(path.join(parent, entry)).pipe(Effect.map((manifest) => [{
|
|
382
340
|
directory: path.join(parent, entry),
|
|
383
341
|
manifest
|
|
384
342
|
}]), Effect.orElseSucceed(() => [])), { concurrency: 1 });
|
|
@@ -400,7 +358,7 @@ const tarballsOf = Effect.fn("compat.tarballs")(function* tarballsOf({ directory
|
|
|
400
358
|
/** @internal */
|
|
401
359
|
const workspaceTarballs = Effect.fn("compat.local")(function* workspaceTarballs(directory, manifest) {
|
|
402
360
|
const known = yield* workspacesBeside(directory);
|
|
403
|
-
const reached = closureOf(known,
|
|
361
|
+
const reached = closureOf(known, runtimeDependencyNames(manifest), [{
|
|
404
362
|
directory,
|
|
405
363
|
manifest
|
|
406
364
|
}]);
|
|
@@ -408,13 +366,16 @@ const workspaceTarballs = Effect.fn("compat.local")(function* workspaceTarballs(
|
|
|
408
366
|
return Record.fromEntries(Array.flatten(packed));
|
|
409
367
|
});
|
|
410
368
|
// src/features/publish-workspace/model/compat.ts
|
|
411
|
-
const MANIFEST_FILE$2 = "package.json";
|
|
412
369
|
const INSTALL_FLAGS = ["--no-audit", "--no-fund"];
|
|
413
|
-
const
|
|
370
|
+
const NOT_LOADED = String.raw`ERR_(MODULE_NOT_FOUND|PACKAGE_|INVALID_PACKAGE|UNKNOWN_FILE|UNSUPPORTED_DIR|REQUIRE_ESM)|SyntaxError`;
|
|
371
|
+
/** @internal */
|
|
372
|
+
const LOAD_FAILURE = `/${NOT_LOADED}/u`;
|
|
373
|
+
/** @internal */
|
|
374
|
+
const CRASH = String.raw`/${NOT_LOADED}|\n\s+at\s.+:\d+:\d+/u`;
|
|
375
|
+
const BIN_ARGUMENTS = [["--help"], ["--compat-unknown-flag"]];
|
|
414
376
|
const IMPORT_ONLY = "await import(process.argv[1])";
|
|
415
|
-
const
|
|
377
|
+
const spawnChecked = (failure) => `import { spawnSync } from "node:child_process"; const { stderr } = spawnSync(process.execPath, process.argv.slice(1), { encoding: "utf8", stdio: ["ignore", "ignore", "pipe"], timeout: 60000 }); if (${failure}.test(stderr)) { process.stderr.write(stderr); process.exit(1); }`;
|
|
416
378
|
const Versions$1 = Schema.String.pipe(Schema.Array, Schema.fromJsonString);
|
|
417
|
-
const ConsumerJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));
|
|
418
379
|
const installedNode = Effect.fn("compat.node")(function* installedNode(directory, range) {
|
|
419
380
|
const path = yield* Path.Path;
|
|
420
381
|
yield* (yield* FileSystem.FileSystem).makeDirectory(directory, { recursive: true });
|
|
@@ -444,21 +405,19 @@ const installedNode = Effect.fn("compat.node")(function* installedNode(directory
|
|
|
444
405
|
binary: path.join(directory, "node_modules", "node", "bin", "node")
|
|
445
406
|
};
|
|
446
407
|
});
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
overrides: Record.fromIterableWith(Record.keys(tarballs), (sibling) => [sibling, `$${sibling}`])
|
|
456
|
-
});
|
|
408
|
+
const consumerFields = ({ peers, tarballs }) => ({
|
|
409
|
+
private: true,
|
|
410
|
+
type: "module",
|
|
411
|
+
dependencies: {
|
|
412
|
+
...peers,
|
|
413
|
+
...pipe(tarballs, Record.map((file) => `file:${file}`))
|
|
414
|
+
},
|
|
415
|
+
overrides: Record.fromIterableWith(Record.keys(tarballs), (sibling) => [sibling, `$${sibling}`])
|
|
457
416
|
});
|
|
458
417
|
const withViteOfVitePlus = Effect.fn("compat.vite")(function* withViteOfVitePlus(directory) {
|
|
459
418
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
460
419
|
const path = yield* Path.Path;
|
|
461
|
-
const text = yield* fileSystem.readFileString(path.join(directory, "node_modules", VITE_PLUS,
|
|
420
|
+
const text = yield* fileSystem.readFileString(path.join(directory, "node_modules", VITE_PLUS, PACKAGE_JSON_FILE));
|
|
462
421
|
yield* Option.match(viteAliasOf(text), {
|
|
463
422
|
onNone: () => Effect.void,
|
|
464
423
|
onSome: (alias) => mustSucceed({
|
|
@@ -476,11 +435,9 @@ const withViteOfVitePlus = Effect.fn("compat.vite")(function* withViteOfVitePlus
|
|
|
476
435
|
});
|
|
477
436
|
const installedConsumer = Effect.fn("compat.consumer")(function* installedConsumer(root, consumer) {
|
|
478
437
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
479
|
-
const
|
|
480
|
-
const directory = path.join(root, "consumer");
|
|
438
|
+
const directory = (yield* Path.Path).join(root, "consumer");
|
|
481
439
|
yield* fileSystem.makeDirectory(directory, { recursive: true });
|
|
482
|
-
|
|
483
|
-
yield* fileSystem.writeFileString(path.join(directory, MANIFEST_FILE$2), text);
|
|
440
|
+
yield* writePackageJson(directory, consumerFields(consumer));
|
|
484
441
|
yield* mustSucceed({
|
|
485
442
|
command: "npm",
|
|
486
443
|
args: [
|
|
@@ -493,37 +450,43 @@ const installedConsumer = Effect.fn("compat.consumer")(function* installedConsum
|
|
|
493
450
|
if (Record.has(consumer.peers, "vite-plus")) yield* withViteOfVitePlus(directory);
|
|
494
451
|
return directory;
|
|
495
452
|
});
|
|
496
|
-
const loadsCleanly = ({ runtime, consumer, args }) => mustSucceed({
|
|
453
|
+
const loadsCleanly = ({ runtime, consumer, failure, args }) => mustSucceed({
|
|
497
454
|
command: runtime,
|
|
498
455
|
args: [
|
|
499
456
|
"--input-type=module",
|
|
500
457
|
"-e",
|
|
501
|
-
|
|
458
|
+
spawnChecked(failure),
|
|
502
459
|
"--",
|
|
503
460
|
...args
|
|
504
461
|
],
|
|
505
462
|
cwd: consumer
|
|
506
463
|
});
|
|
507
|
-
const
|
|
464
|
+
const importsOf = (manifest, compat) => {
|
|
465
|
+
if (compat.label === "npx") return [];
|
|
466
|
+
return smokeTargetsOf(manifest).imports;
|
|
467
|
+
};
|
|
468
|
+
const smoke = Effect.fn("compat.smoke")(function* smoke({ manifest, compat, runtime, consumer }) {
|
|
508
469
|
const path = yield* Path.Path;
|
|
509
|
-
const { imports, bins } = smokeTargetsOf(manifest);
|
|
510
470
|
const importer = [
|
|
511
471
|
"--input-type=module",
|
|
512
472
|
"-e",
|
|
513
473
|
IMPORT_ONLY
|
|
514
474
|
];
|
|
515
|
-
|
|
475
|
+
const runs = pipe(smokeTargetsOf(manifest).bins, Array.flatMap((file) => pipe(BIN_ARGUMENTS, Array.map((args) => [path.join(consumer, "node_modules", manifest.name, file), ...args]))));
|
|
476
|
+
yield* Effect.forEach(importsOf(manifest, compat), (specifier) => loadsCleanly({
|
|
516
477
|
runtime,
|
|
517
478
|
consumer,
|
|
479
|
+
failure: LOAD_FAILURE,
|
|
518
480
|
args: [...importer, specifier]
|
|
519
481
|
}), {
|
|
520
482
|
concurrency: 1,
|
|
521
483
|
discard: true
|
|
522
484
|
});
|
|
523
|
-
yield* Effect.forEach(
|
|
485
|
+
yield* Effect.forEach(runs, (args) => loadsCleanly({
|
|
524
486
|
runtime,
|
|
525
487
|
consumer,
|
|
526
|
-
|
|
488
|
+
failure: CRASH,
|
|
489
|
+
args
|
|
527
490
|
}), {
|
|
528
491
|
concurrency: 1,
|
|
529
492
|
discard: true
|
|
@@ -540,11 +503,16 @@ const runCase = Effect.fn("compat.case")(function* runCase({ manifest, tarballs,
|
|
|
540
503
|
});
|
|
541
504
|
const peers = pipe(Record.toEntries(compat.peers), Array.map(([name, range]) => `${name}@${range}`), Array.join(", "));
|
|
542
505
|
yield* Console.log(`${manifest.name} ${compat.label}: Node.js ${runtime.version}, peers ${peers}`);
|
|
543
|
-
yield* smoke(
|
|
506
|
+
yield* smoke({
|
|
507
|
+
manifest,
|
|
508
|
+
compat,
|
|
509
|
+
runtime: runtime.binary,
|
|
510
|
+
consumer
|
|
511
|
+
});
|
|
544
512
|
}, Effect.scoped);
|
|
545
513
|
/** @internal */
|
|
546
514
|
const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory) {
|
|
547
|
-
const manifest = yield*
|
|
515
|
+
const manifest = yield* readVersionedPackageJson(directory);
|
|
548
516
|
const cases = compatCasesOf(manifest);
|
|
549
517
|
if (Array.isReadonlyArrayEmpty(cases)) return yield* IncompatiblePackage.make({ message: `${manifest.name} declares no engines.node, so there is no supported Node.js range to check` });
|
|
550
518
|
const tarballs = yield* workspaceTarballs(directory, manifest);
|
|
@@ -558,31 +526,10 @@ const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory)
|
|
|
558
526
|
});
|
|
559
527
|
}, Effect.scoped);
|
|
560
528
|
// src/features/publish-workspace/model/manifest.ts
|
|
561
|
-
const MANIFEST_FILE$1 = "package.json";
|
|
562
|
-
const SCOPE = /^@[^/]+\//u;
|
|
563
529
|
const UNVERSIONED$1 = "0.0.0";
|
|
564
530
|
const ROOT = ".";
|
|
565
|
-
const Native = Schema.Struct({
|
|
566
|
-
binary: Schema.String,
|
|
567
|
-
targets: Schema.Array(Schema.String)
|
|
568
|
-
});
|
|
569
|
-
const ManifestSchema = Schema.Struct({
|
|
570
|
-
name: Schema.String,
|
|
571
|
-
version: Schema.String,
|
|
572
|
-
private: Schema.optionalKey(Schema.Boolean),
|
|
573
|
-
dependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
|
|
574
|
-
native: Schema.optionalKey(Native),
|
|
575
|
-
"size-limit": Schema.optionalKey(Schema.Unknown)
|
|
576
|
-
});
|
|
577
|
-
/** @internal */
|
|
578
|
-
const manifestIn = Effect.fn("publish.manifest")(function* manifestIn(directory) {
|
|
579
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
580
|
-
const path = yield* Path.Path;
|
|
581
|
-
const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$1));
|
|
582
|
-
return yield* Schema.decodeEffect(Schema.fromJsonString(ManifestSchema))(text);
|
|
583
|
-
});
|
|
584
531
|
/** @internal */
|
|
585
|
-
const releaseName = ({ name }) =>
|
|
532
|
+
const releaseName = ({ name }) => unscopedNameOf(name);
|
|
586
533
|
/** @internal */
|
|
587
534
|
const isRoot = (directory) => directory === ROOT;
|
|
588
535
|
/** @internal */
|
|
@@ -622,7 +569,7 @@ const failWhenMissing = (missing, manifest) => {
|
|
|
622
569
|
};
|
|
623
570
|
const missingDependencies = Effect.fn("publish.missingDependencies")(function* missingDependencies({ manifest, workspaces }) {
|
|
624
571
|
const wanted = workspaceDependencies(manifest);
|
|
625
|
-
const siblings = yield* Effect.forEach(workspaces, (directory) =>
|
|
572
|
+
const siblings = yield* Effect.forEach(workspaces, (directory) => readVersionedPackageJson(directory).pipe(Effect.map((found) => ({
|
|
626
573
|
directory,
|
|
627
574
|
...found
|
|
628
575
|
}))), { concurrency: READ_CONCURRENCY });
|
|
@@ -901,7 +848,7 @@ const nativeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.native), Opt
|
|
|
901
848
|
/** @internal */
|
|
902
849
|
const planOf = Effect.fn("publish.plan")(function* planOf(directory) {
|
|
903
850
|
const workspace = yield* workspaceOf(directory);
|
|
904
|
-
const manifest = yield*
|
|
851
|
+
const manifest = yield* readVersionedPackageJson(workspace);
|
|
905
852
|
const graph = yield* graphTasks;
|
|
906
853
|
const tasks = tasksIn(graph, workspace);
|
|
907
854
|
const npm = yield* needsNpm(workspace, manifest, workspacesOf(graph));
|
|
@@ -934,7 +881,7 @@ const untaggedCurrent = Effect.fn("publish.untaggedCurrent")(function* untaggedC
|
|
|
934
881
|
})));
|
|
935
882
|
});
|
|
936
883
|
const pending = Effect.fn("publish.pending")(function* pending(graph, directory) {
|
|
937
|
-
const manifest = yield*
|
|
884
|
+
const manifest = yield* readVersionedPackageJson(directory);
|
|
938
885
|
const builds = buildsOf(tasksIn(graph, directory));
|
|
939
886
|
const needed = yield* Effect.all([
|
|
940
887
|
unpublished(directory, manifest),
|
|
@@ -975,7 +922,7 @@ const writePlan = Effect.fn("publish.writePlan")(function* writePlan(plan) {
|
|
|
975
922
|
// src/features/publish-workspace/model/compat-plan.ts
|
|
976
923
|
const Directories = Schema.String.pipe(Schema.Array, Schema.fromJsonString);
|
|
977
924
|
const isChecked = Effect.fn("compat.isChecked")(function* isChecked(directory) {
|
|
978
|
-
const manifest = yield*
|
|
925
|
+
const manifest = yield* readVersionedPackageJson(directory);
|
|
979
926
|
return goesToNpm(manifest) && !Array.isReadonlyArrayEmpty(compatCasesOf(manifest));
|
|
980
927
|
});
|
|
981
928
|
/** @internal */
|
|
@@ -987,16 +934,11 @@ const writeCompatPlan = Effect.fn("publish.compatPlan")(function* writeCompatPla
|
|
|
987
934
|
yield* writeOutputs({ directories: encoded });
|
|
988
935
|
});
|
|
989
936
|
// src/features/publish-workspace/model/npm.ts
|
|
990
|
-
const MANIFEST_FILE = "package.json";
|
|
991
937
|
const PUBLISH_FLAGS = [
|
|
992
938
|
"--provenance",
|
|
993
939
|
"--access",
|
|
994
940
|
"public"
|
|
995
941
|
];
|
|
996
|
-
const PlatformManifest = Schema.fromJsonString(Schema.Struct({
|
|
997
|
-
name: Schema.String,
|
|
998
|
-
version: Schema.String
|
|
999
|
-
}));
|
|
1000
942
|
const authEnv = Effect.fn("publish.authEnv")(function* authEnv() {
|
|
1001
943
|
const token = yield* brokerCredential({
|
|
1002
944
|
kind: "npm",
|
|
@@ -1025,9 +967,7 @@ const verifyPackage = Effect.fn("publish.verify")(function* verifyPackage(direct
|
|
|
1025
967
|
yield* checkCompat(directory);
|
|
1026
968
|
});
|
|
1027
969
|
const publishNative = Effect.fn("publish.publishNative")(function* publishNative(target, env) {
|
|
1028
|
-
const
|
|
1029
|
-
const path = yield* Path.Path;
|
|
1030
|
-
const { name, version } = yield* fileSystem.readFileString(path.join(target, MANIFEST_FILE)).pipe(Effect.flatMap(Schema.decodeEffect(PlatformManifest)));
|
|
970
|
+
const { name, version } = yield* readVersionedPackageJson(target);
|
|
1031
971
|
if (yield* onNpm({
|
|
1032
972
|
directory: target,
|
|
1033
973
|
name,
|
|
@@ -1048,17 +988,7 @@ const publishNative = Effect.fn("publish.publishNative")(function* publishNative
|
|
|
1048
988
|
});
|
|
1049
989
|
return name;
|
|
1050
990
|
});
|
|
1051
|
-
const addOptionalDependencies =
|
|
1052
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
1053
|
-
const file = (yield* Path.Path).join(directory, MANIFEST_FILE);
|
|
1054
|
-
const manifest = yield* fileSystem.readFileString(file).pipe(Effect.flatMap(Schema.decodeEffect(PackageJson)));
|
|
1055
|
-
const optionalDependencies = pipe(names, Array.map((name) => [name, version]), Record.fromEntries);
|
|
1056
|
-
const updated = yield* Schema.encodeEffect(PackageJson)({
|
|
1057
|
-
...manifest,
|
|
1058
|
-
optionalDependencies
|
|
1059
|
-
});
|
|
1060
|
-
yield* fileSystem.writeFileString(file, updated);
|
|
1061
|
-
});
|
|
991
|
+
const addOptionalDependencies = (directory, names, version) => updatePackageJson(directory, { optionalDependencies: pipe(names, Array.map((name) => [name, version]), Record.fromEntries) }).pipe(Effect.withSpan("publish.optionalDependencies"));
|
|
1062
992
|
const publishNatives = Effect.fn("publish.publishNatives")(function* publishNatives(directory, manifest, env) {
|
|
1063
993
|
if (Predicate.isUndefined(manifest.native)) return;
|
|
1064
994
|
const { binary, targets } = manifest.native;
|
|
@@ -1073,7 +1003,7 @@ const publishNatives = Effect.fn("publish.publishNatives")(function* publishNati
|
|
|
1073
1003
|
});
|
|
1074
1004
|
/** @internal */
|
|
1075
1005
|
const publishToNpm = Effect.fn("publish.npm")(function* publishToNpm(directory) {
|
|
1076
|
-
const manifest = yield*
|
|
1006
|
+
const manifest = yield* readVersionedPackageJson(directory);
|
|
1077
1007
|
if (yield* onNpm({
|
|
1078
1008
|
directory,
|
|
1079
1009
|
...manifest
|
|
@@ -1187,7 +1117,7 @@ const uploadAssets = Effect.fn("publish.uploadAssets")(function* uploadAssets({
|
|
|
1187
1117
|
});
|
|
1188
1118
|
/** @internal */
|
|
1189
1119
|
const publishRelease = Effect.fn("publish.release")(function* publishRelease(directory) {
|
|
1190
|
-
const manifest = yield*
|
|
1120
|
+
const manifest = yield* readVersionedPackageJson(directory);
|
|
1191
1121
|
if (!isVersioned(manifest)) {
|
|
1192
1122
|
yield* Effect.logInfo(`${manifest.name} has no version to publish`);
|
|
1193
1123
|
return;
|
|
@@ -1239,7 +1169,7 @@ const publish = Effect.gen(function* publish() {
|
|
|
1239
1169
|
const [step, directory] = yield* Schema.decodeUnknownEffect(Arguments)(args).pipe(Effect.mapError(() => UsageError.make({ message: USAGE })));
|
|
1240
1170
|
return yield* steps[step](directory);
|
|
1241
1171
|
});
|
|
1242
|
-
runCli(publish);
|
|
1172
|
+
runCli("msch-publish")(publish);
|
|
1243
1173
|
export {};
|
|
1244
1174
|
|
|
1245
1175
|
//# sourceMappingURL=publish.mjs.map
|