Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Node.js Package

on:
release:
types: [published]

workflow_dispatch:

jobs:
publish:
if: github.repository == 'misskey-dev/mfm.js'
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
node-version: [22.23.2]

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
package-manager-cache: false
registry-url: 'https://registry.npmjs.org'

# Ensure npm 11.5.1 or later is installed
- name: Update npm
run: npm install -g npm@latest

- name: Publish package
run: |
pnpm i --frozen-lockfile
pnpm build
pnpm publish --access public --no-git-checks --provenance
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
### Bugfixes

-->
## 0.x.x (unreleased)
## 0.27.0
### Bugfixes
- Restore CLI commands that are accidentally removed in 0.26.0
- Security fixes
- Update dependencies

## 0.26.0
### Features
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ PRを作成する前に、以下をご確認ください:
ご協力ありがとうございます🤗

## Tools
### eslint
このプロジェクトではコードのフォーマットチェック/整形に[eslint](https://eslint.org/)を導入しています。
### oxlint
このプロジェクトではコードのフォーマットチェック/整形に[oxlint](https://oxc.rs/docs/guide/usage/linter)を導入しています。
CI上でも自動でチェックされ、ルールに則っていないコードがあるとエラーになります。

### Jest
Expand Down
36 changes: 0 additions & 36 deletions eslint.config.js

This file was deleted.

40 changes: 20 additions & 20 deletions etc/cfm-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
```ts

// @public (undocumented)
export const BOLD: (children: MfmInline[]) => NodeType<"bold">;
export const BOLD: (children: MfmInline[]) => NodeType<'bold'>;

// @public (undocumented)
export const CENTER: (children: MfmInline[]) => NodeType<"center">;
export const CENTER: (children: MfmInline[]) => NodeType<'center'>;

// @public (undocumented)
export const CODE_BLOCK: (code: string, lang: string | null) => NodeType<"blockCode">;
export const CODE_BLOCK: (code: string, lang: string | null) => NodeType<'blockCode'>;

// @public (undocumented)
export const EMOJI_CODE: (name: string) => NodeType<"emojiCode">;
export const EMOJI_CODE: (name: string) => NodeType<'emojiCode'>;

// @public (undocumented)
export function extract(nodes: MfmNode[], predicate: (node: MfmNode) => boolean): MfmNode[];

// @public (undocumented)
export const FN: (name: string, args: MfmFn["props"]["args"], children: MfmFn["children"]) => NodeType<"fn">;
export const FN: (name: string, args: MfmFn['props']['args'], children: MfmFn['children']) => NodeType<'fn'>;

// @public (undocumented)
export const HASHTAG: (value: string) => NodeType<"hashtag">;
export const HASHTAG: (value: string) => NodeType<'hashtag'>;

// @public (undocumented)
export const INLINE_CODE: (code: string) => NodeType<"inlineCode">;
export const INLINE_CODE: (code: string) => NodeType<'inlineCode'>;

// @public (undocumented)
export function inspect(node: MfmNode, action: (node: MfmNode) => void): void;
Expand All @@ -38,19 +38,19 @@ export function inspect(nodes: MfmNode[], action: (node: MfmNode) => void): void
export function isMfmBlock(node: MfmNode): node is MfmBlock;

// @public (undocumented)
export const ITALIC: (children: MfmInline[]) => NodeType<"italic">;
export const ITALIC: (children: MfmInline[]) => NodeType<'italic'>;

// @public (undocumented)
export const LINK: (silent: boolean, url: string, children: MfmInline[]) => NodeType<"link">;
export const LINK: (silent: boolean, url: string, children: MfmInline[]) => NodeType<'link'>;

// @public (undocumented)
export const MATH_BLOCK: (formula: string) => NodeType<"mathBlock">;
export const MATH_BLOCK: (formula: string) => NodeType<'mathBlock'>;

// @public (undocumented)
export const MATH_INLINE: (formula: string) => NodeType<"mathInline">;
export const MATH_INLINE: (formula: string) => NodeType<'mathInline'>;

// @public (undocumented)
export const MENTION: (username: string, host: string | null, acct: string) => NodeType<"mention">;
export const MENTION: (username: string, host: string | null, acct: string) => NodeType<'mention'>;

// @public (undocumented)
export type MfmBlock = MfmQuote | MfmSearch | MfmCodeBlock | MfmMathBlock | MfmCenter;
Expand Down Expand Up @@ -238,7 +238,7 @@ export type MfmUrl = {
};

// @public (undocumented)
export const N_URL: (value: string, brackets?: boolean) => NodeType<"url">;
export const N_URL: (value: string, brackets?: boolean) => NodeType<'url'>;

// @public (undocumented)
export type NodeType<T extends MfmNode['type']> = T extends 'quote' ? MfmQuote : T extends 'search' ? MfmSearch : T extends 'blockCode' ? MfmCodeBlock : T extends 'mathBlock' ? MfmMathBlock : T extends 'center' ? MfmCenter : T extends 'unicodeEmoji' ? MfmUnicodeEmoji : T extends 'emojiCode' ? MfmEmojiCode : T extends 'bold' ? MfmBold : T extends 'small' ? MfmSmall : T extends 'italic' ? MfmItalic : T extends 'strike' ? MfmStrike : T extends 'inlineCode' ? MfmInlineCode : T extends 'mathInline' ? MfmMathInline : T extends 'mention' ? MfmMention : T extends 'hashtag' ? MfmHashtag : T extends 'url' ? MfmUrl : T extends 'link' ? MfmLink : T extends 'fn' ? MfmFn : T extends 'plain' ? MfmPlain : T extends 'text' ? MfmText : never;
Expand All @@ -252,22 +252,22 @@ export function parse(input: string, opts?: Partial<{
export function parseSimple(input: string): MfmSimpleNode[];

// @public (undocumented)
export const PLAIN: (text: string) => NodeType<"plain">;
export const PLAIN: (text: string) => NodeType<'plain'>;

// @public (undocumented)
export const QUOTE: (children: MfmNode[]) => NodeType<"quote">;
export const QUOTE: (children: MfmNode[]) => NodeType<'quote'>;

// @public (undocumented)
export const SEARCH: (query: string, content: string) => NodeType<"search">;
export const SEARCH: (query: string, content: string) => NodeType<'search'>;

// @public (undocumented)
export const SMALL: (children: MfmInline[]) => NodeType<"small">;
export const SMALL: (children: MfmInline[]) => NodeType<'small'>;

// @public (undocumented)
export const STRIKE: (children: MfmInline[]) => NodeType<"strike">;
export const STRIKE: (children: MfmInline[]) => NodeType<'strike'>;

// @public (undocumented)
export const TEXT: (value: string) => NodeType<"text">;
export const TEXT: (value: string) => NodeType<'text'>;

// @public (undocumented)
function toString_2(tree: MfmNode[]): string;
Expand All @@ -277,7 +277,7 @@ function toString_2(node: MfmNode): string;
export { toString_2 as toString }

// @public (undocumented)
export const UNI_EMOJI: (value: string) => NodeType<"unicodeEmoji">;
export const UNI_EMOJI: (value: string) => NodeType<'unicodeEmoji'>;

// (No @packageDocumentation comment for this package)

Expand Down
40 changes: 20 additions & 20 deletions etc/mfc-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
```ts

// @public (undocumented)
export const BOLD: (children: MfmInline[]) => NodeType<"bold">;
export const BOLD: (children: MfmInline[]) => NodeType<'bold'>;

// @public (undocumented)
export const CENTER: (children: MfmInline[]) => NodeType<"center">;
export const CENTER: (children: MfmInline[]) => NodeType<'center'>;

// @public (undocumented)
export const CODE_BLOCK: (code: string, lang: string | null) => NodeType<"blockCode">;
export const CODE_BLOCK: (code: string, lang: string | null) => NodeType<'blockCode'>;

// @public (undocumented)
export const EMOJI_CODE: (name: string) => NodeType<"emojiCode">;
export const EMOJI_CODE: (name: string) => NodeType<'emojiCode'>;

// @public (undocumented)
export function extract(nodes: MfmNode[], predicate: (node: MfmNode) => boolean): MfmNode[];

// @public (undocumented)
export const FN: (name: string, args: MfmFn["props"]["args"], children: MfmFn["children"]) => NodeType<"fn">;
export const FN: (name: string, args: MfmFn['props']['args'], children: MfmFn['children']) => NodeType<'fn'>;

// @public (undocumented)
export const HASHTAG: (value: string) => NodeType<"hashtag">;
export const HASHTAG: (value: string) => NodeType<'hashtag'>;

// @public (undocumented)
export const INLINE_CODE: (code: string) => NodeType<"inlineCode">;
export const INLINE_CODE: (code: string) => NodeType<'inlineCode'>;

// @public (undocumented)
export function inspect(node: MfmNode, action: (node: MfmNode) => void): void;
Expand All @@ -38,19 +38,19 @@ export function inspect(nodes: MfmNode[], action: (node: MfmNode) => void): void
export function isMfmBlock(node: MfmNode): node is MfmBlock;

// @public (undocumented)
export const ITALIC: (children: MfmInline[]) => NodeType<"italic">;
export const ITALIC: (children: MfmInline[]) => NodeType<'italic'>;

// @public (undocumented)
export const LINK: (silent: boolean, url: string, children: MfmInline[]) => NodeType<"link">;
export const LINK: (silent: boolean, url: string, children: MfmInline[]) => NodeType<'link'>;

// @public (undocumented)
export const MATH_BLOCK: (formula: string) => NodeType<"mathBlock">;
export const MATH_BLOCK: (formula: string) => NodeType<'mathBlock'>;

// @public (undocumented)
export const MATH_INLINE: (formula: string) => NodeType<"mathInline">;
export const MATH_INLINE: (formula: string) => NodeType<'mathInline'>;

// @public (undocumented)
export const MENTION: (username: string, host: string | null, acct: string) => NodeType<"mention">;
export const MENTION: (username: string, host: string | null, acct: string) => NodeType<'mention'>;

// @public (undocumented)
export type MfmBlock = MfmQuote | MfmSearch | MfmCodeBlock | MfmMathBlock | MfmCenter;
Expand Down Expand Up @@ -238,7 +238,7 @@ export type MfmUrl = {
};

// @public (undocumented)
export const N_URL: (value: string, brackets?: boolean) => NodeType<"url">;
export const N_URL: (value: string, brackets?: boolean) => NodeType<'url'>;

// @public (undocumented)
export type NodeType<T extends MfmNode['type']> = T extends 'quote' ? MfmQuote : T extends 'search' ? MfmSearch : T extends 'blockCode' ? MfmCodeBlock : T extends 'mathBlock' ? MfmMathBlock : T extends 'center' ? MfmCenter : T extends 'unicodeEmoji' ? MfmUnicodeEmoji : T extends 'emojiCode' ? MfmEmojiCode : T extends 'bold' ? MfmBold : T extends 'small' ? MfmSmall : T extends 'italic' ? MfmItalic : T extends 'strike' ? MfmStrike : T extends 'inlineCode' ? MfmInlineCode : T extends 'mathInline' ? MfmMathInline : T extends 'mention' ? MfmMention : T extends 'hashtag' ? MfmHashtag : T extends 'url' ? MfmUrl : T extends 'link' ? MfmLink : T extends 'fn' ? MfmFn : T extends 'plain' ? MfmPlain : T extends 'text' ? MfmText : never;
Expand All @@ -252,22 +252,22 @@ export function parse(input: string, opts?: Partial<{
export function parseSimple(input: string): MfmSimpleNode[];

// @public (undocumented)
export const PLAIN: (text: string) => NodeType<"plain">;
export const PLAIN: (text: string) => NodeType<'plain'>;

// @public (undocumented)
export const QUOTE: (children: MfmNode[]) => NodeType<"quote">;
export const QUOTE: (children: MfmNode[]) => NodeType<'quote'>;

// @public (undocumented)
export const SEARCH: (query: string, content: string) => NodeType<"search">;
export const SEARCH: (query: string, content: string) => NodeType<'search'>;

// @public (undocumented)
export const SMALL: (children: MfmInline[]) => NodeType<"small">;
export const SMALL: (children: MfmInline[]) => NodeType<'small'>;

// @public (undocumented)
export const STRIKE: (children: MfmInline[]) => NodeType<"strike">;
export const STRIKE: (children: MfmInline[]) => NodeType<'strike'>;

// @public (undocumented)
export const TEXT: (value: string) => NodeType<"text">;
export const TEXT: (value: string) => NodeType<'text'>;

// @public (undocumented)
function toString_2(tree: MfmNode[]): string;
Expand All @@ -277,7 +277,7 @@ function toString_2(node: MfmNode): string;
export { toString_2 as toString }

// @public (undocumented)
export const UNI_EMOJI: (value: string) => NodeType<"unicodeEmoji">;
export const UNI_EMOJI: (value: string) => NodeType<'unicodeEmoji'>;

// (No @packageDocumentation comment for this package)

Expand Down
13 changes: 13 additions & 0 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineMisskeyDevOxlintConfig } from '@misskey-dev/oxlint-fmt-config';

export default defineMisskeyDevOxlintConfig({
overrides: {
ignorePatterns: [
'src/@types/package.json.d.ts',
'built',
'test',
'test-d',
],
},
});

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "mfc-js",
"version": "0.1.0",
"baseMfmJsVersion": "0.26.0",
"version": "0.2.0",
"baseMfmJsVersion": "0.27.0",
"description": "An MFM parser implementation with TypeScript",
"type": "module",
"packageManager": "pnpm@11.8.0",
"packageManager": "pnpm@12.11.2",
"main": "./built/index.mjs",
"types": "./built/index.d.ts",
"exports": {
Expand All @@ -23,7 +23,7 @@
"parse-simple": "node ./built/cli/parseSimple.cjs",
"api": "pnpm exec api-extractor run --local --verbose",
"api-prod": "pnpm exec api-extractor run --verbose",
"lint": "eslint",
"lint": "oxlint",
"vitest": "vitest run --coverage",
"test": "pnpm run vitest && pnpm run tsd"
},
Expand All @@ -34,20 +34,20 @@
"author": "Marihachi",
"license": "MIT",
"devDependencies": {
"@microsoft/api-extractor": "7.58.9",
"@misskey-dev/eslint-plugin": "^2.1.0",
"@types/node": "22.20.0",
"@typescript-eslint/eslint-plugin": "8.62.0",
"@typescript-eslint/parser": "8.62.0",
"@vitest/coverage-v8": "4.1.9",
"eslint": "9.39.4",
"@microsoft/api-extractor": "7.59.4",
"@misskey-dev/oxlint-fmt-config": "0.1.1",
"@stylistic/eslint-plugin": "5.10.0",
"@types/node": "26.6.5",
"@vitest/coverage-v8": "5.0.3",
"oxlint": "1.87.0",
"oxlint-tsgolint": "7.0.2004",
"tsd": "0.33.0",
"tsdown": "^0.21.10",
"typescript": "5.9.3",
"vitest": "4.1.9"
"tsdown": "0.23.1",
"typescript": "7.0.2",
"vitest": "5.0.3"
},
"dependencies": {
"@misskey-dev/emoji-data": "17.0.5"
"@misskey-dev/emoji-data": "17.0.3"
},
"files": [
"built",
Expand Down
Loading
Loading