@r_masseater/y8 0.0.0 → 0.2.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/LICENSE +87 -0
- package/README.md +50 -0
- package/dist/app-DJaOhWCw.mjs +466 -0
- package/dist/app-DJaOhWCw.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +19 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index-AoTF_uMY.d.mts +10 -0
- package/dist/index-CkE9LH6X.d.mts +92 -0
- package/dist/index-Dvd9WB0d.d.mts +25 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.mjs +3 -0
- package/dist/kuromojin.d.mts +3 -0
- package/dist/kuromojin.mjs +1 -0
- package/dist/split-morphemes-DC2pNnQU.mjs +289 -0
- package/dist/split-morphemes-DC2pNnQU.mjs.map +1 -0
- package/dist/vite.d.mts +7 -0
- package/dist/vite.mjs +1 -0
- package/logo.svg +15 -0
- package/package.json +91 -6
- package/skills/lint-markdown/SKILL.md +96 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-morphemes-DC2pNnQU.mjs","names":["taggedError","Rec","Str","DATA_FIRST_ARITY","Arr","Fn","Str","Fn","Bool","Arr","Arr","Arr"],"sources":["../../lint-host/src/entities/rule/model/setting.ts","../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/shared/lib/errors.ts","../src/shared/native/source.ts","../src/shared/native/index.ts","../src/features/split-morphemes/model/tokenize.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nexport type Severity = \"off\" | \"warn\" | \"error\";\n\nexport type RuleOptions = Readonly<Record<string, unknown>>;\n\nexport type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];\n\nexport interface Setting {\n readonly severity: Severity;\n readonly options: RuleOptions;\n}\n\nconst NO_OPTIONS: RuleOptions = {};\n\nexport const settingOf = (entry: RuleEntry): Setting =>\n Match.value(entry).pipe(\n Match.when(Match.string, (severity): Setting => ({ severity, options: NO_OPTIONS })),\n Match.orElse(([severity, options]): Setting => ({\n severity,\n options: options ?? NO_OPTIONS,\n })),\n );\n","import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(NodeServices.layer)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly args: readonly string[];\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(\n Effect.withSpan(`${cli.name}.files`),\n );\n const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));\n const found = yield* cli.lint({ root, files, projectFiles, config });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf = <Config, Found, Failure>(\n tool: Tool<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, args: process.argv.slice(ARGUMENTS_START) });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(NodeServices.layer),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n runTraced(cli.name, mainOf(cli));\n};\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n runTraced(tool.name, toolMainOf(tool));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n}\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class Y8Error extends taggedError<Y8Error, { readonly brand: unique symbol }>()(\"Y8Error\", {\n message: Schema.String,\n}) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): Y8Error =>\n Y8Error.make({ message: `${message}: ${String(cause)}` });\n","import { Option } from \"effect\";\n\nimport type { NodeType } from \"./index.ts\";\n\nconst WORD = 4;\nconst EMPTY = 0;\nconst HEADER_WORDS = 5;\nconst HEADER = { nodes: 0, strings: 1, lines: 2, text: 3 } as const;\nconst STRING_WORDS = 2;\nconst LENGTH = 1;\nexport const NODE_WORDS = 8;\n\nexport const FIELD = {\n tag: 0,\n start: 1,\n end: 2,\n parent: 3,\n firstChild: 4,\n nextSibling: 5,\n first: 6,\n second: 7,\n} as const;\n\nexport const TAGS: readonly NodeType[] = [\n \"document\",\n \"paragraph\",\n \"heading\",\n \"blockQuote\",\n \"codeBlock\",\n \"htmlBlock\",\n \"list\",\n \"listItem\",\n \"footnoteDefinition\",\n \"table\",\n \"tableHead\",\n \"tableRow\",\n \"tableCell\",\n \"emphasis\",\n \"strong\",\n \"strikethrough\",\n \"link\",\n \"image\",\n \"text\",\n \"code\",\n \"html\",\n \"inlineHtml\",\n \"softBreak\",\n \"hardBreak\",\n \"thematicBreak\",\n \"math\",\n \"mathBlock\",\n \"footnoteReference\",\n \"taskListMarker\",\n \"other\",\n];\n\nexport interface SourceView {\n readonly nodeCount: number;\n readonly nodes: Uint32Array;\n readonly lineStarts: Uint32Array;\n readonly text: () => string;\n readonly slice: (start: number, end: number) => string;\n readonly stringAt: (index: number) => string;\n}\n\nconst decoder = new TextDecoder();\n\nconst padded = (length: number): number => Math.ceil(length / WORD) * WORD;\n\nconst aligned = (buffer: Uint8Array): Uint8Array =>\n Option.match(\n Option.liftPredicate(buffer, ({ byteOffset }) => byteOffset % WORD === EMPTY),\n {\n onNone: () => Uint8Array.from(buffer),\n onSome: (value) => value,\n },\n );\n\nconst wordAt = (words: Uint32Array, index: number): number => words[index] ?? EMPTY;\n\nconst decode = (from: Uint8Array, start: number, end: number): string =>\n decoder.decode(from.subarray(start, end));\n\ninterface Layout {\n readonly nodeCount: number;\n readonly stringCount: number;\n readonly lineCount: number;\n readonly textLength: number;\n}\n\nconst wordsOf =\n (buffer: Uint8Array) =>\n (at: number, count: number): Uint32Array =>\n new Uint32Array(buffer.buffer, buffer.byteOffset + at * WORD, count);\n\nconst layoutOf = (header: Uint32Array): Layout => ({\n nodeCount: wordAt(header, HEADER.nodes),\n stringCount: wordAt(header, HEADER.strings),\n lineCount: wordAt(header, HEADER.lines),\n textLength: wordAt(header, HEADER.text),\n});\n\nexport const sourceView = (raw: Uint8Array): SourceView => {\n const buffer = aligned(raw);\n const words = wordsOf(buffer);\n const { nodeCount, stringCount, lineCount, textLength } = layoutOf(words(EMPTY, HEADER_WORDS));\n const stringsAt = HEADER_WORDS + nodeCount * NODE_WORDS;\n const linesAt = stringsAt + stringCount * STRING_WORDS;\n const textAt = (linesAt + lineCount) * WORD;\n const bytes = buffer.subarray(textAt, textAt + textLength);\n const strings = words(stringsAt, stringCount * STRING_WORDS);\n const blob = buffer.subarray(textAt + padded(textLength));\n return {\n nodeCount,\n nodes: words(HEADER_WORDS, nodeCount * NODE_WORDS),\n lineStarts: words(linesAt, lineCount),\n text: () => decoder.decode(bytes),\n slice: (start, end) => decode(bytes, start, end),\n stringAt: (index) => {\n const offset = wordAt(strings, index * STRING_WORDS);\n return decode(blob, offset, offset + wordAt(strings, index * STRING_WORDS + LENGTH));\n },\n };\n};\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Predicate, pipe } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { Y8Error } from \"#/shared/lib/errors.ts\";\n\nexport { FIELD, NODE_WORDS, TAGS, sourceView } from \"./source.ts\";\nexport type { SourceView } from \"./source.ts\";\n\nexport type NodeType =\n | \"document\"\n | \"paragraph\"\n | \"heading\"\n | \"blockQuote\"\n | \"codeBlock\"\n | \"htmlBlock\"\n | \"list\"\n | \"listItem\"\n | \"footnoteDefinition\"\n | \"table\"\n | \"tableHead\"\n | \"tableRow\"\n | \"tableCell\"\n | \"emphasis\"\n | \"strong\"\n | \"strikethrough\"\n | \"link\"\n | \"image\"\n | \"text\"\n | \"code\"\n | \"html\"\n | \"inlineHtml\"\n | \"softBreak\"\n | \"hardBreak\"\n | \"thematicBreak\"\n | \"math\"\n | \"mathBlock\"\n | \"footnoteReference\"\n | \"taskListMarker\"\n | \"other\";\n\nexport type Level = \"error\" | \"warning\" | \"info\";\n\nexport interface NativeDiagnostic {\n readonly line: number;\n readonly ruleNames: readonly string[];\n readonly description: string;\n readonly detail: string | null;\n readonly context: string | null;\n readonly range: readonly [number, number] | null;\n readonly severity: Exclude<Level, \"info\">;\n}\n\nexport interface PluginDiagnostic {\n readonly rule: string;\n readonly line: number;\n readonly column: number;\n readonly message: string;\n readonly detail: string | null;\n readonly severity: Exclude<Level, \"info\">;\n}\n\nexport interface PluginOptions {\n readonly name: string;\n readonly prefix: string;\n readonly rules: Readonly<Record<string, string>>;\n}\n\nexport interface NativeResult {\n readonly path: string;\n readonly diagnostics: readonly NativeDiagnostic[];\n readonly pluginDiagnostics?: readonly PluginDiagnostic[] | null;\n readonly source?: Uint8Array | null;\n}\n\nexport interface NativeOptions {\n readonly config?: Readonly<Record<string, unknown>>;\n readonly inlineConfig?: boolean;\n readonly keepTree?: boolean;\n readonly keepSource?: boolean;\n readonly traceparent?: string;\n readonly root?: string;\n readonly plugins?: readonly PluginOptions[];\n}\n\nexport interface SourceFile {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface Morpheme {\n readonly word_id: number;\n readonly word_type: \"KNOWN\" | \"UNKNOWN\";\n readonly surface_form: string;\n readonly pos: string;\n readonly pos_detail_1: string;\n readonly pos_detail_2: string;\n readonly pos_detail_3: string;\n readonly conjugated_type: string;\n readonly conjugated_form: string;\n readonly basic_form: string;\n readonly reading?: string;\n readonly pronunciation?: string;\n readonly word_position: number;\n}\n\nexport interface Native {\n readonly lint: (files: readonly SourceFile[], options: NativeOptions) => readonly NativeResult[];\n readonly lintPaths: (\n root: string,\n paths: readonly string[],\n options: NativeOptions,\n ) => readonly NativeResult[];\n readonly flushTelemetry: () => Promise<void>;\n readonly readTexts: (root: string, paths: readonly string[]) => readonly (string | null)[];\n readonly tokenize: (text: string) => string;\n}\n\nconst NATIVE_FUNCTIONS = [\"lint\", \"lintPaths\", \"flushTelemetry\", \"readTexts\", \"tokenize\"] as const;\n\nconst hasFunction =\n (value: unknown) =>\n (name: string): boolean =>\n Predicate.hasProperty(value, name) && Predicate.isFunction(value[name]);\n\nconst isNative = (value: unknown): value is Native =>\n pipe(NATIVE_FUNCTIONS, Arr.every(hasFunction(value)));\n\nexport const native: Effect.Effect<Native, Y8Error> = loadAddon({\n packageName: \"@r_masseater/y8\",\n binary: \"y8\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { native } from \"#/shared/native/index.ts\";\nimport type { Morpheme } from \"#/shared/native/index.ts\";\n\nexport interface Tokenizer {\n readonly tokenize: (text: string) => readonly Morpheme[];\n readonly tokenizeForSentence: (text: string) => readonly Morpheme[];\n}\n\nconst CACHE_SIZE = 10_000;\nconst NO_MORPHEMES: readonly Morpheme[] = [];\n\nconst addon = Effect.cached(native).pipe(Effect.runSync);\n\nconst cache = new Map<string, readonly Morpheme[]>();\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\n\nconst isMorphemes = (value: unknown): value is readonly Morpheme[] => Arr.isArray(value);\n\nconst parsed = (json: string): readonly Morpheme[] =>\n pipe(\n decodeJson(json),\n Option.filter(isMorphemes),\n Option.getOrElse(() => NO_MORPHEMES),\n );\n\nconst remember = (text: string, morphemes: readonly Morpheme[]): readonly Morpheme[] => {\n if (cache.size >= CACHE_SIZE) {\n cache.clear();\n }\n cache.set(text, morphemes);\n return morphemes;\n};\n\nexport const morphemesOf = (text: string): readonly Morpheme[] =>\n pipe(\n Option.fromUndefinedOr(cache.get(text)),\n Option.getOrElse(() => remember(text, parsed(pipe(addon, Effect.runSync).tokenize(text)))),\n );\n\nconst tokenizer: Tokenizer = { tokenize: morphemesOf, tokenizeForSentence: morphemesOf };\n\nexport const getTokenizer = (): Promise<Tokenizer> => Promise.resolve(tokenizer);\n\nexport const tokenize = (text: string): Promise<readonly Morpheme[]> =>\n Promise.resolve(morphemesOf(text));\n"],"mappings":";;;;;;;;;AAaA,MAAM,aAA0B,CAAC;AAEjC,MAAa,aAAa,UACxB,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,MAAM,SAAS,cAAuB;CAAE;CAAU,SAAS;AAAW,EAAE,GACnF,MAAM,QAAQ,CAAC,UAAU,cAAuB;CAC9C;CACA,SAAS,WAAW;AACtB,EAAE,CACJ;;ACpBF,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,UAA8D;CAClE,QAAQ,SAAS,MAAM,KAAK;CAC5B,SAAS,SAAS,MAAM,KAAK;CAC7B,QAAQ,S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AAO,MAAM,CAAC,CAAC,KAAK,OAAO,OAAO;AAEvD,MAAM,wBAAQ,IAAI,IAAiC;AAEnD,MAAM,aAAa,OAAO,oBAAoB,OAAO,eAAe,OAAO,OAAO,CAAC;AAEnF,MAAM,eAAe,UAAiDC,MAAI,QAAQ,KAAK;AAEvF,MAAM,UAAU,SACd,KACE,WAAW,IAAI,GACf,OAAO,OAAO,WAAW,GACzB,OAAO,gBAAgB,YAAY,CACrC;AAEF,MAAM,YAAY,MAAc,cAAwD;CACtF,IAAI,MAAM,QAAQ,YAChB,MAAM,MAAM;CAEd,MAAM,IAAI,MAAM,SAAS;CACzB,OAAO;AACT;AAEA,MAAa,eAAe,SAC1B,KACE,OAAO,gBAAgB,MAAM,IAAI,IAAI,CAAC,GACtC,OAAO,gBAAgB,SAAS,MAAM,OAAO,KAAK,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAC3F;AAEF,MAAM,YAAuB;CAAE,UAAU;CAAa,qBAAqB;AAAY;AAEvF,MAAa,qBAAyC,QAAQ,QAAQ,SAAS;AAE/E,MAAa,YAAY,SACvB,QAAQ,QAAQ,YAAY,IAAI,CAAC"}
|
package/dist/vite.d.mts
ADDED
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/logo.svg
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:c2pa="http://c2pa.org/manifest">
|
|
2
|
+
<rect width="512" height="512" fill="#232339"/>
|
|
3
|
+
<g stroke-linecap="round" fill="none">
|
|
4
|
+
<g stroke-width="44" opacity="0.22">
|
|
5
|
+
<path d="M96 214 L330 128" stroke="#4FD6E0"/>
|
|
6
|
+
<path d="M150 312 L428 210" stroke="#F0469A"/>
|
|
7
|
+
<path d="M118 396 L300 330" stroke="#F2C94C"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g stroke-width="20">
|
|
10
|
+
<path d="M96 214 L330 128" stroke="#4FD6E0"/>
|
|
11
|
+
<path d="M150 312 L428 210" stroke="#F0469A"/>
|
|
12
|
+
<path d="M118 396 L300 330" stroke="#F2C94C"/>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
<metadata><c2pa:manifest>AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTo2Njg3NmJiNy1lMTk3LTRiMDYtYjNmMC0wZWY2OTFlMWE4Y2UAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncmVkaWVudC52MwAAAAAYYzJzaIVqXk535iqNm9wMxz0Y24QAAABwY2JvcqNpZGM6Zm9ybWF0bWltYWdlL3N2Zyt4bWxqaW5zdGFuY2VJRHgseG1wOmlpZDoyYTAzYmY0Yi02NzU4LTRmOTgtOWIzNy0yNGQ3ZjU1Y2E1YTRscmVsYXRpb25zaGlwaHBhcmVudE9mAAAB4mp1bWIAAABBanVtZGNib3IAEQAQgAAAqgA4m3ETYzJwYS5hY3Rpb25zLnYyAAAAABhjMnNoa851/pbUop5VKEl4pr44EgAAAZljYm9yomdhY3Rpb25zgqJmYWN0aW9ua2MycGEub3BlbmVkanBhcmFtZXRlcnOha2luZ3JlZGllbnRzgaJjdXJseC1zZWxmI2p1bWJmPWMycGEuYXNzZXJ0aW9ucy9jMnBhLmluZ3JlZGllbnQudjNkaGFzaFgg7XgzTNbFpCRrNVnN+k9pvnhOKtVIR81KLy3oFT2dWxukZmFjdGlvbngdY29tLmFudGhyb3BpYy5jbGF1ZGUucHJvdmlkZWRqcGFyYW1ldGVyc6F4H2NvbS5hbnRocm9waWMub3JpZ2luLWNvbmZpZGVuY2VndW5rbm93bmtkZXNjcml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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQJIka0Flyzo/nolC9gZf505mkI5/12+pfeqeoETIgOyP6cXdhEAZ88lWbRFoxB9YH6PksqnS6itb0hzX0VdAwO0=</c2pa:manifest></metadata></svg>
|
package/package.json
CHANGED
|
@@ -1,15 +1,100 @@
|
|
|
1
1
|
{
|
|
2
|
+
"name": "@r_masseater/y8",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A Markdown linter written in Rust that matches markdownlint's built-in rules, configured from vite.config.ts, with TypeScript rules, markdownlint custom-rule support and a Japanese tokenizer.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"lint",
|
|
7
|
+
"markdown",
|
|
8
|
+
"markdownlint",
|
|
9
|
+
"tanstack-intent",
|
|
10
|
+
"vite-plus"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/masseater/masseater.dev/tree/main/libs/y8#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/masseater/masseater.dev/issues"
|
|
15
|
+
},
|
|
2
16
|
"license": "MIT",
|
|
3
17
|
"repository": {
|
|
4
18
|
"type": "git",
|
|
5
19
|
"url": "git+https://github.com/masseater/masseater.dev.git",
|
|
6
20
|
"directory": "libs/y8"
|
|
7
21
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"url": "https://github.com/masseater/masseater.dev/issues"
|
|
22
|
+
"bin": {
|
|
23
|
+
"y8": "./dist/cli.mjs"
|
|
11
24
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
"files": [
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"dist",
|
|
28
|
+
"logo.svg",
|
|
29
|
+
"skills/lint-markdown"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"imports": {
|
|
33
|
+
"#/*": "./src/*"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"default": "./dist/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./kuromojin": {
|
|
41
|
+
"types": "./dist/kuromojin.d.mts",
|
|
42
|
+
"default": "./dist/kuromojin.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./vite": {
|
|
45
|
+
"types": "./dist/vite.d.mts",
|
|
46
|
+
"default": "./dist/vite.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./package.json": "./package.json"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"provenance": true
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@effect/platform-node": "^4.1.4",
|
|
56
|
+
"minimatch": "^11.0.8",
|
|
57
|
+
"yaml": "^2.9.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@masseater.dev/lint-host": "0.0.0",
|
|
61
|
+
"@r_masseater/vitest-otlp": "0.2.0",
|
|
62
|
+
"@types/node": "26.6.6",
|
|
63
|
+
"effect": "4.1.4",
|
|
64
|
+
"markdownlint": "0.42.1",
|
|
65
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
|
|
66
|
+
"vite-plus": "1.7.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"effect": "^4.1.2",
|
|
70
|
+
"markdownlint": ">=0.42.0",
|
|
71
|
+
"vite": "*",
|
|
72
|
+
"vite-plus": ">=1.5.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"markdownlint": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"vite": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"vite-plus": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": "v26.13.1"
|
|
87
|
+
},
|
|
88
|
+
"native": {
|
|
89
|
+
"binary": "y8",
|
|
90
|
+
"targets": [
|
|
91
|
+
"linux-x64-gnu",
|
|
92
|
+
"win32-x64-msvc"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"optionalDependencies": {
|
|
96
|
+
"@r_masseater/y8-linux-x64-gnu": "0.2.0",
|
|
97
|
+
"@r_masseater/y8-win32-x64-msvc": "0.2.0"
|
|
98
|
+
},
|
|
99
|
+
"scripts": {}
|
|
15
100
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-markdown
|
|
3
|
+
description: >
|
|
4
|
+
Use when setting up @r_masseater/y8 in vite.config.ts, writing a Markdown lint rule in
|
|
5
|
+
TypeScript with defineRule, running markdownlint custom rules through it, or fixing what it
|
|
6
|
+
reports. Covers rule severity and options, inline disable comments, and the CLI.
|
|
7
|
+
metadata:
|
|
8
|
+
type: core
|
|
9
|
+
library: "@r_masseater/y8"
|
|
10
|
+
library_version: 0.1.0
|
|
11
|
+
sources:
|
|
12
|
+
- src/app/index.ts
|
|
13
|
+
- src/shared/config/types.ts
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# lint-markdown
|
|
17
|
+
|
|
18
|
+
y8 is a Markdown linter written in Rust. Its built-in rules give the same results as
|
|
19
|
+
markdownlint's MD001 to MD060. They are named `markdownlint/<MDxxx or alias>`.
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
vp add -D @r_masseater/y8
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import "@r_masseater/y8/vite";
|
|
29
|
+
import { defineConfig } from "vite-plus";
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
y8: {
|
|
33
|
+
rules: {
|
|
34
|
+
"markdownlint/MD013": "off",
|
|
35
|
+
"markdownlint/MD024": ["error", { siblings_only: true }],
|
|
36
|
+
},
|
|
37
|
+
ignores: ["vendor/**"],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Every built-in rule is on as an error unless `rules` says otherwise. A rule entry is `"off"`,
|
|
43
|
+
`"warn"`, `"error"`, or a tuple of the severity and markdownlint's options for that rule.
|
|
44
|
+
|
|
45
|
+
Run `y8` in the repository root. It lints the Markdown files git tracks and prints
|
|
46
|
+
`path:line:column severity rule message`. It exits with 1 when any error is reported.
|
|
47
|
+
|
|
48
|
+
## Per-file rules
|
|
49
|
+
|
|
50
|
+
`overrides` takes `{ files, rules }` entries, as oxlint does. Globs starting with `!` exclude files,
|
|
51
|
+
and later entries win.
|
|
52
|
+
|
|
53
|
+
Rule packages export presets that return a whole config.
|
|
54
|
+
Built-in plugins run inside the native engine, as oxlint's built-in plugins do. `agnix` runs the agnix rules for agent files: register it as `plugins: { agnix }` and its rules are named `agnix/<ID>`, or `<name>/<ID>` under another key. Set one to `"off"`, `"warn"` or `"error"`; unset rules keep agnix's own level.
|
|
55
|
+
|
|
56
|
+
## Rules in TypeScript
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { definePlugin, defineRule } from "@r_masseater/y8";
|
|
60
|
+
|
|
61
|
+
const noTodo = defineRule({
|
|
62
|
+
meta: { description: "No TODO left in the docs" },
|
|
63
|
+
create: (context) => ({
|
|
64
|
+
text: (node) => {
|
|
65
|
+
if (context.textOf(node).includes("TODO")) {
|
|
66
|
+
context.report({ node, message: "Resolve the TODO" });
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const local = definePlugin({ rules: { "no-todo": noTodo } });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Register it as `plugins: { local }` and turn it on with `"local/no-todo": "error"`. Visitors are
|
|
76
|
+
keyed by node type, and `<type>:exit` runs after the children. The context also gives the parsed
|
|
77
|
+
`frontmatter`, `exists(path)` and `filesUnder(directory)` for repository files, and the nearest
|
|
78
|
+
`manifest` (package.json).
|
|
79
|
+
|
|
80
|
+
## markdownlint custom rules
|
|
81
|
+
|
|
82
|
+
Pass existing markdownlint custom rules as `definePlugin({ markdownlintRules: [rule] })`.
|
|
83
|
+
Install `markdownlint` next to y8. They run through markdownlint itself under the plugin's
|
|
84
|
+
name, such as `legacy/no-here`.
|
|
85
|
+
|
|
86
|
+
## Inline comments
|
|
87
|
+
|
|
88
|
+
markdownlint's comments work, and `y8-` works in place of `markdownlint-`, as in
|
|
89
|
+
`<!-- y8-disable-next-line MD033 -->`. Turn them off with `inlineConfig: false`.
|
|
90
|
+
|
|
91
|
+
## Japanese tokens
|
|
92
|
+
|
|
93
|
+
`morphemesOf(text)` returns kuromoji-shaped morphemes (`surface_form`, `pos`, `pos_detail_1`,
|
|
94
|
+
`basic_form`, `reading`, `word_position`, ...) from the IPADIC dictionary built into the addon,
|
|
95
|
+
so a rule can look at Japanese words. `@r_masseater/y8/kuromojin` exports `tokenize` and
|
|
96
|
+
`getTokenizer` with kuromojin's signatures.
|