1
0
Fork 1
mirror of https://example.com synced 2024-11-22 06:56:38 +09:00

refactor: rename backend/native-utils to backend-rs

This commit is contained in:
naskya 2024-01-23 01:29:15 +09:00
parent 20bfd954a3
commit 01e8ae37f8
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
211 changed files with 531 additions and 578 deletions

View file

@ -10,7 +10,7 @@ node_modules
report.*.json report.*.json
# Rust # Rust
packages/backend/native-utils/target packages/backend-rs/target
# Cypress # Cypress
cypress/screenshots cypress/screenshots

View file

@ -15,12 +15,12 @@ RUN <<EOC
EOC EOC
# Copy only the cargo dependency-related files first, to cache efficiently # Copy only the cargo dependency-related files first, to cache efficiently
COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml COPY packages/backend-rs/Cargo.toml packages/backend-rs/Cargo.toml
COPY packages/backend/native-utils/Cargo.lock packages/backend/native-utils/Cargo.lock COPY packages/backend-rs/Cargo.lock packages/backend-rs/Cargo.lock
COPY packages/backend/native-utils/src/lib.rs packages/backend/native-utils/src/ COPY packages/backend-rs/src/lib.rs packages/backend-rs/src/
# Install cargo dependencies # Install cargo dependencies
RUN cargo fetch --locked --manifest-path /firefish/packages/backend/native-utils/Cargo.toml RUN cargo fetch --locked --manifest-path /firefish/packages/backend-rs/Cargo.toml
# Copy only the dependency-related files first, to cache efficiently # Copy only the dependency-related files first, to cache efficiently
COPY package.json pnpm*.yaml ./ COPY package.json pnpm*.yaml ./
@ -29,18 +29,18 @@ COPY packages/client/package.json packages/client/package.json
COPY packages/sw/package.json packages/sw/package.json COPY packages/sw/package.json packages/sw/package.json
COPY packages/firefish-js/package.json packages/firefish-js/package.json COPY packages/firefish-js/package.json packages/firefish-js/package.json
COPY packages/megalodon/package.json packages/megalodon/package.json COPY packages/megalodon/package.json packages/megalodon/package.json
COPY packages/backend/native-utils/package.json packages/backend/native-utils/package.json COPY packages/backend-rs/package.json packages/backend-rs/package.json
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json COPY packages/backend-rs/npm/linux-x64-musl/package.json packages/backend-rs/npm/linux-x64-musl/package.json
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json COPY packages/backend-rs/npm/linux-arm64-musl/package.json packages/backend-rs/npm/linux-arm64-musl/package.json
# Configure pnpm, and install dev mode dependencies for compilation # Configure pnpm, and install dev mode dependencies for compilation
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm install --frozen-lockfile RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm install --frozen-lockfile
# Copy in the rest of the native-utils rust files # Copy in the rest of the rust files
COPY packages/backend/native-utils packages/backend/native-utils/ COPY packages/backend-rs packages/backend-rs/
# Compile native-utils # Compile backend-rs
RUN pnpm run --filter native-utils build RUN pnpm run --filter backend-rs build
# Copy in the rest of the files to compile # Copy in the rest of the files to compile
COPY . ./ COPY . ./
@ -51,7 +51,7 @@ ENV VERSION=${VERSION}
RUN pnpm pkg set version="${VERSION}" RUN pnpm pkg set version="${VERSION}"
# Compile # Compile
RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pnpm run gulp" RUN env NODE_ENV=production sh -c "pnpm run --filter '!backend-rs' build && pnpm run gulp"
# Trim down the dependencies to only those for production # Trim down the dependencies to only those for production
RUN pnpm install --prod --frozen-lockfile RUN pnpm install --prod --frozen-lockfile
@ -73,6 +73,7 @@ COPY --from=build /firefish/packages/megalodon /firefish/packages/megalodon
# Copy node modules # Copy node modules
COPY --from=build /firefish/node_modules /firefish/node_modules COPY --from=build /firefish/node_modules /firefish/node_modules
COPY --from=build /firefish/packages/backend/node_modules /firefish/packages/backend/node_modules COPY --from=build /firefish/packages/backend/node_modules /firefish/packages/backend/node_modules
COPY --from=build /firefish/packages/backend-rs/node_modules /firefish/packages/backend-rs/node_modules
COPY --from=build /firefish/packages/sw/node_modules /firefish/packages/sw/node_modules COPY --from=build /firefish/packages/sw/node_modules /firefish/packages/sw/node_modules
COPY --from=build /firefish/packages/client/node_modules /firefish/packages/client/node_modules COPY --from=build /firefish/packages/client/node_modules /firefish/packages/client/node_modules
COPY --from=build /firefish/packages/firefish-js/node_modules /firefish/packages/firefish-js/node_modules COPY --from=build /firefish/packages/firefish-js/node_modules /firefish/packages/firefish-js/node_modules
@ -81,7 +82,7 @@ COPY --from=build /firefish/packages/firefish-js/node_modules /firefish/packages
COPY --from=build /firefish/built /firefish/built COPY --from=build /firefish/built /firefish/built
COPY --from=build /firefish/packages/backend/built /firefish/packages/backend/built COPY --from=build /firefish/packages/backend/built /firefish/packages/backend/built
COPY --from=build /firefish/packages/backend/assets/instance.css /firefish/packages/backend/assets/instance.css COPY --from=build /firefish/packages/backend/assets/instance.css /firefish/packages/backend/assets/instance.css
COPY --from=build /firefish/packages/backend/native-utils/built /firefish/packages/backend/native-utils/built COPY --from=build /firefish/packages/backend-rs/built /firefish/packages/backend-rs/built
RUN corepack enable && corepack prepare pnpm@latest --activate RUN corepack enable && corepack prepare pnpm@latest --activate
ARG VERSION ARG VERSION

View file

@ -4,12 +4,13 @@ recursive_wildcard=$(foreach d, $(wildcard $(1:=/*)), $(call recursive_wildcard,
PACKAGE_JSONS := package.json PACKAGE_JSONS := package.json
PACKAGE_JSONS += packages/backend/package.json PACKAGE_JSONS += packages/backend/package.json
PACKAGE_JSONS += packages/backend-rs/package.json
PACKAGE_JSONS += packages/client/package.json PACKAGE_JSONS += packages/client/package.json
PACKAGE_JSONS += packages/firefish-js/package.json PACKAGE_JSONS += packages/firefish-js/package.json
PACKAGE_JSONS += packages/megalodon/package.json PACKAGE_JSONS += packages/megalodon/package.json
PACKAGE_JSONS += packages/sw/package.json PACKAGE_JSONS += packages/sw/package.json
RUST_DIR := packages/backend/native-utils RUST_DIR := packages/backend-rs
RUSTY_STUFF := $(call recursive_wildcard, $(RUST_DIR)/src, *) RUSTY_STUFF := $(call recursive_wildcard, $(RUST_DIR)/src, *)
RUSTY_STUFF += $(RUST_DIR)/Cargo.toml RUSTY_STUFF += $(RUST_DIR)/Cargo.toml
@ -83,7 +84,7 @@ format:
rust-lint: $(T)/rust-lint rust-lint: $(T)/rust-lint
$(T)/rust-lint: $(RUSTY_STUFF) $(T)/rust-lint: $(RUSTY_STUFF)
pnpm --filter='native-utils' run lint pnpm --filter='backend-rs' run lint
touch $@ touch $@
@ -110,7 +111,7 @@ $(T)/regenerate-entities: $(MIGRATIONS)
neko/index.js: $(RUSTY_STUFF) neko/index.js: $(RUSTY_STUFF)
pnpm --filter='native-utils' run build:debug pnpm --filter='backend-rs' run build:debug
[ -f $(RUST_DIR)/built/index.js ] [ -f $(RUST_DIR)/built/index.js ]
pnpm run format pnpm run format
rm neko/index.js rm neko/index.js

View file

@ -11,7 +11,7 @@
- この Firefish はよく Firefish neko flavor と呼ばれていますが、これはこのバージョン番号に由来します。私自身は特にこの呼称を普及させたいわけではなかったのですが、[私のアカウント](https://post.naskya.net/@dev)の数割のフォロワーが英語圏の本家 Firefish の利用者であるため単に「この機能を追加しました!」などと投稿すると本家版の更新と誤解される恐れがありますし、「私の Firefish フォークにこの機能を追加しました!」などと投稿すると私が本家 Firefish の開発を離れて新たなハードフォークを作っているのだと誤解される恐れがあるため、投稿を機械翻訳で英訳されて読まれてもなるべく誤解されないための苦肉の策としてこの呼称を使い始めました。このソフトフォークはあくまで本家 Firefish の私による「味付け」です。 - この Firefish はよく Firefish neko flavor と呼ばれていますが、これはこのバージョン番号に由来します。私自身は特にこの呼称を普及させたいわけではなかったのですが、[私のアカウント](https://post.naskya.net/@dev)の数割のフォロワーが英語圏の本家 Firefish の利用者であるため単に「この機能を追加しました!」などと投稿すると本家版の更新と誤解される恐れがありますし、「私の Firefish フォークにこの機能を追加しました!」などと投稿すると私が本家 Firefish の開発を離れて新たなハードフォークを作っているのだと誤解される恐れがあるため、投稿を機械翻訳で英訳されて読まれてもなるべく誤解されないための苦肉の策としてこの呼称を使い始めました。このソフトフォークはあくまで本家 Firefish の私による「味付け」です。
- 依存ライブラリをほとんど常に最新版にアップデート - 依存ライブラリをほとんど常に最新版にアップデート
- 本家版を更新する前にちゃんと動くか実験したいという意図もあります - 本家版を更新する前にちゃんと動くか実験したいという意図もあります
- `native-utils/migration` を廃止 - Rust によるデータベースのマイグレーションを廃止
- Rust に移植できる部分は少しずつ移植していきますが、Rust によるデータベースのマイグレーションは(少なくとも当面の間)行いません - Rust に移植できる部分は少しずつ移植していきますが、Rust によるデータベースのマイグレーションは(少なくとも当面の間)行いません
## クライアントの変更点 ## クライアントの変更点

View file

@ -57,7 +57,7 @@ make
make run make run
``` ```
### lockfile や native-utils の entity の更新やコードのフォーマットなど(コミット前に行ってください) ### lockfile の更新やコードのフォーマットなど(コミット前に行ってください)
```bash ```bash
make make

View file

@ -4,371 +4,326 @@
/* auto-generated by NAPI-RS */ /* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require("fs"); const { existsSync, readFileSync } = require('fs')
const { join } = require("path"); const { join } = require('path')
const { platform, arch } = process; const { platform, arch } = process
let nativeBinding = null; let nativeBinding = null
let localFileExisted = false; let localFileExisted = false
let loadError = null; let loadError = null
function isMusl() { function isMusl() {
// For Node 10 // For Node 10
if (!process.report || typeof process.report.getReport !== "function") { if (!process.report || typeof process.report.getReport !== 'function') {
try { try {
const lddPath = require("child_process") const lddPath = require('child_process').execSync('which ldd').toString().trim()
.execSync("which ldd") return readFileSync(lddPath, 'utf8').includes('musl')
.toString() } catch (e) {
.trim(); return true
return readFileSync(lddPath, "utf8").includes("musl"); }
} catch (e) { } else {
return true; const { glibcVersionRuntime } = process.report.getReport().header
} return !glibcVersionRuntime
} else { }
const { glibcVersionRuntime } = process.report.getReport().header;
return !glibcVersionRuntime;
}
} }
switch (platform) { switch (platform) {
case "android": case 'android':
switch (arch) { switch (arch) {
case "arm64": case 'arm64':
localFileExisted = existsSync( localFileExisted = existsSync(join(__dirname, 'backend-rs.android-arm64.node'))
join(__dirname, "native-utils.android-arm64.node"), try {
); if (localFileExisted) {
try { nativeBinding = require('./backend-rs.android-arm64.node')
if (localFileExisted) { } else {
nativeBinding = require("./native-utils.android-arm64.node"); nativeBinding = require('backend-rs-android-arm64')
} else { }
nativeBinding = require("native-utils-android-arm64"); } catch (e) {
} loadError = e
} catch (e) { }
loadError = e; break
} case 'arm':
break; localFileExisted = existsSync(join(__dirname, 'backend-rs.android-arm-eabi.node'))
case "arm": try {
localFileExisted = existsSync( if (localFileExisted) {
join(__dirname, "native-utils.android-arm-eabi.node"), nativeBinding = require('./backend-rs.android-arm-eabi.node')
); } else {
try { nativeBinding = require('backend-rs-android-arm-eabi')
if (localFileExisted) { }
nativeBinding = require("./native-utils.android-arm-eabi.node"); } catch (e) {
} else { loadError = e
nativeBinding = require("native-utils-android-arm-eabi"); }
} break
} catch (e) { default:
loadError = e; throw new Error(`Unsupported architecture on Android ${arch}`)
} }
break; break
default: case 'win32':
throw new Error(`Unsupported architecture on Android ${arch}`); switch (arch) {
} case 'x64':
break; localFileExisted = existsSync(
case "win32": join(__dirname, 'backend-rs.win32-x64-msvc.node')
switch (arch) { )
case "x64": try {
localFileExisted = existsSync( if (localFileExisted) {
join(__dirname, "native-utils.win32-x64-msvc.node"), nativeBinding = require('./backend-rs.win32-x64-msvc.node')
); } else {
try { nativeBinding = require('backend-rs-win32-x64-msvc')
if (localFileExisted) { }
nativeBinding = require("./native-utils.win32-x64-msvc.node"); } catch (e) {
} else { loadError = e
nativeBinding = require("native-utils-win32-x64-msvc"); }
} break
} catch (e) { case 'ia32':
loadError = e; localFileExisted = existsSync(
} join(__dirname, 'backend-rs.win32-ia32-msvc.node')
break; )
case "ia32": try {
localFileExisted = existsSync( if (localFileExisted) {
join(__dirname, "native-utils.win32-ia32-msvc.node"), nativeBinding = require('./backend-rs.win32-ia32-msvc.node')
); } else {
try { nativeBinding = require('backend-rs-win32-ia32-msvc')
if (localFileExisted) { }
nativeBinding = require("./native-utils.win32-ia32-msvc.node"); } catch (e) {
} else { loadError = e
nativeBinding = require("native-utils-win32-ia32-msvc"); }
} break
} catch (e) { case 'arm64':
loadError = e; localFileExisted = existsSync(
} join(__dirname, 'backend-rs.win32-arm64-msvc.node')
break; )
case "arm64": try {
localFileExisted = existsSync( if (localFileExisted) {
join(__dirname, "native-utils.win32-arm64-msvc.node"), nativeBinding = require('./backend-rs.win32-arm64-msvc.node')
); } else {
try { nativeBinding = require('backend-rs-win32-arm64-msvc')
if (localFileExisted) { }
nativeBinding = require("./native-utils.win32-arm64-msvc.node"); } catch (e) {
} else { loadError = e
nativeBinding = require("native-utils-win32-arm64-msvc"); }
} break
} catch (e) { default:
loadError = e; throw new Error(`Unsupported architecture on Windows: ${arch}`)
} }
break; break
default: case 'darwin':
throw new Error(`Unsupported architecture on Windows: ${arch}`); localFileExisted = existsSync(join(__dirname, 'backend-rs.darwin-universal.node'))
} try {
break; if (localFileExisted) {
case "darwin": nativeBinding = require('./backend-rs.darwin-universal.node')
localFileExisted = existsSync( } else {
join(__dirname, "native-utils.darwin-universal.node"), nativeBinding = require('backend-rs-darwin-universal')
); }
try { break
if (localFileExisted) { } catch {}
nativeBinding = require("./native-utils.darwin-universal.node"); switch (arch) {
} else { case 'x64':
nativeBinding = require("native-utils-darwin-universal"); localFileExisted = existsSync(join(__dirname, 'backend-rs.darwin-x64.node'))
} try {
break; if (localFileExisted) {
} catch {} nativeBinding = require('./backend-rs.darwin-x64.node')
switch (arch) { } else {
case "x64": nativeBinding = require('backend-rs-darwin-x64')
localFileExisted = existsSync( }
join(__dirname, "native-utils.darwin-x64.node"), } catch (e) {
); loadError = e
try { }
if (localFileExisted) { break
nativeBinding = require("./native-utils.darwin-x64.node"); case 'arm64':
} else { localFileExisted = existsSync(
nativeBinding = require("native-utils-darwin-x64"); join(__dirname, 'backend-rs.darwin-arm64.node')
} )
} catch (e) { try {
loadError = e; if (localFileExisted) {
} nativeBinding = require('./backend-rs.darwin-arm64.node')
break; } else {
case "arm64": nativeBinding = require('backend-rs-darwin-arm64')
localFileExisted = existsSync( }
join(__dirname, "native-utils.darwin-arm64.node"), } catch (e) {
); loadError = e
try { }
if (localFileExisted) { break
nativeBinding = require("./native-utils.darwin-arm64.node"); default:
} else { throw new Error(`Unsupported architecture on macOS: ${arch}`)
nativeBinding = require("native-utils-darwin-arm64"); }
} break
} catch (e) { case 'freebsd':
loadError = e; if (arch !== 'x64') {
} throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
break; }
default: localFileExisted = existsSync(join(__dirname, 'backend-rs.freebsd-x64.node'))
throw new Error(`Unsupported architecture on macOS: ${arch}`); try {
} if (localFileExisted) {
break; nativeBinding = require('./backend-rs.freebsd-x64.node')
case "freebsd": } else {
if (arch !== "x64") { nativeBinding = require('backend-rs-freebsd-x64')
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`); }
} } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.freebsd-x64.node"), }
); break
try { case 'linux':
if (localFileExisted) { switch (arch) {
nativeBinding = require("./native-utils.freebsd-x64.node"); case 'x64':
} else { if (isMusl()) {
nativeBinding = require("native-utils-freebsd-x64"); localFileExisted = existsSync(
} join(__dirname, 'backend-rs.linux-x64-musl.node')
} catch (e) { )
loadError = e; try {
} if (localFileExisted) {
break; nativeBinding = require('./backend-rs.linux-x64-musl.node')
case "linux": } else {
switch (arch) { nativeBinding = require('backend-rs-linux-x64-musl')
case "x64": }
if (isMusl()) { } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-x64-musl.node"), }
); } else {
try { localFileExisted = existsSync(
if (localFileExisted) { join(__dirname, 'backend-rs.linux-x64-gnu.node')
nativeBinding = require("./native-utils.linux-x64-musl.node"); )
} else { try {
nativeBinding = require("native-utils-linux-x64-musl"); if (localFileExisted) {
} nativeBinding = require('./backend-rs.linux-x64-gnu.node')
} catch (e) { } else {
loadError = e; nativeBinding = require('backend-rs-linux-x64-gnu')
} }
} else { } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-x64-gnu.node"), }
); }
try { break
if (localFileExisted) { case 'arm64':
nativeBinding = require("./native-utils.linux-x64-gnu.node"); if (isMusl()) {
} else { localFileExisted = existsSync(
nativeBinding = require("native-utils-linux-x64-gnu"); join(__dirname, 'backend-rs.linux-arm64-musl.node')
} )
} catch (e) { try {
loadError = e; if (localFileExisted) {
} nativeBinding = require('./backend-rs.linux-arm64-musl.node')
} } else {
break; nativeBinding = require('backend-rs-linux-arm64-musl')
case "arm64": }
if (isMusl()) { } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-arm64-musl.node"), }
); } else {
try { localFileExisted = existsSync(
if (localFileExisted) { join(__dirname, 'backend-rs.linux-arm64-gnu.node')
nativeBinding = require("./native-utils.linux-arm64-musl.node"); )
} else { try {
nativeBinding = require("native-utils-linux-arm64-musl"); if (localFileExisted) {
} nativeBinding = require('./backend-rs.linux-arm64-gnu.node')
} catch (e) { } else {
loadError = e; nativeBinding = require('backend-rs-linux-arm64-gnu')
} }
} else { } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-arm64-gnu.node"), }
); }
try { break
if (localFileExisted) { case 'arm':
nativeBinding = require("./native-utils.linux-arm64-gnu.node"); localFileExisted = existsSync(
} else { join(__dirname, 'backend-rs.linux-arm-gnueabihf.node')
nativeBinding = require("native-utils-linux-arm64-gnu"); )
} try {
} catch (e) { if (localFileExisted) {
loadError = e; nativeBinding = require('./backend-rs.linux-arm-gnueabihf.node')
} } else {
} nativeBinding = require('backend-rs-linux-arm-gnueabihf')
break; }
case "arm": } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-arm-gnueabihf.node"), }
); break
try { case 'riscv64':
if (localFileExisted) { if (isMusl()) {
nativeBinding = require("./native-utils.linux-arm-gnueabihf.node"); localFileExisted = existsSync(
} else { join(__dirname, 'backend-rs.linux-riscv64-musl.node')
nativeBinding = require("native-utils-linux-arm-gnueabihf"); )
} try {
} catch (e) { if (localFileExisted) {
loadError = e; nativeBinding = require('./backend-rs.linux-riscv64-musl.node')
} } else {
break; nativeBinding = require('backend-rs-linux-riscv64-musl')
case "riscv64": }
if (isMusl()) { } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-riscv64-musl.node"), }
); } else {
try { localFileExisted = existsSync(
if (localFileExisted) { join(__dirname, 'backend-rs.linux-riscv64-gnu.node')
nativeBinding = require("./native-utils.linux-riscv64-musl.node"); )
} else { try {
nativeBinding = require("native-utils-linux-riscv64-musl"); if (localFileExisted) {
} nativeBinding = require('./backend-rs.linux-riscv64-gnu.node')
} catch (e) { } else {
loadError = e; nativeBinding = require('backend-rs-linux-riscv64-gnu')
} }
} else { } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-riscv64-gnu.node"), }
); }
try { break
if (localFileExisted) { case 's390x':
nativeBinding = require("./native-utils.linux-riscv64-gnu.node"); localFileExisted = existsSync(
} else { join(__dirname, 'backend-rs.linux-s390x-gnu.node')
nativeBinding = require("native-utils-linux-riscv64-gnu"); )
} try {
} catch (e) { if (localFileExisted) {
loadError = e; nativeBinding = require('./backend-rs.linux-s390x-gnu.node')
} } else {
} nativeBinding = require('backend-rs-linux-s390x-gnu')
break; }
case "s390x": } catch (e) {
localFileExisted = existsSync( loadError = e
join(__dirname, "native-utils.linux-s390x-gnu.node"), }
); break
try { default:
if (localFileExisted) { throw new Error(`Unsupported architecture on Linux: ${arch}`)
nativeBinding = require("./native-utils.linux-s390x-gnu.node"); }
} else { break
nativeBinding = require("native-utils-linux-s390x-gnu"); default:
} throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`);
}
break;
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
} }
if (!nativeBinding) { if (!nativeBinding) {
if (loadError) { if (loadError) {
throw loadError; throw loadError
} }
throw new Error(`Failed to load native binding`); throw new Error(`Failed to load native binding`)
} }
const { const { EnvConfig, readEnvironmentConfig, readServerConfig, AntennaSrcEnum, MutedNoteReasonEnum, NoteVisibilityEnum, NotificationTypeEnum, PageVisibilityEnum, PollNotevisibilityEnum, RelayStatusEnum, UserEmojimodpermEnum, UserProfileFfvisibilityEnum, UserProfileMutingnotificationtypesEnum, stringToAcct, acctToString, getFullApAccount, isSelfHost, extractHost, toPuny, toPunyOptional, convertToHiddenPost, sqlLikeEscape, safeForSql, formatMilliseconds, nativeInitIdGenerator, nativeCreateId, nativeGetTimestamp, genString, IdConvertType, convertId } = nativeBinding
EnvConfig,
readEnvironmentConfig,
readServerConfig,
AntennaSrcEnum,
MutedNoteReasonEnum,
NoteVisibilityEnum,
NotificationTypeEnum,
PageVisibilityEnum,
PollNotevisibilityEnum,
RelayStatusEnum,
UserEmojimodpermEnum,
UserProfileFfvisibilityEnum,
UserProfileMutingnotificationtypesEnum,
stringToAcct,
acctToString,
getFullApAccount,
isSelfHost,
extractHost,
toPuny,
toPunyOptional,
convertToHiddenPost,
sqlLikeEscape,
safeForSql,
formatMilliseconds,
nativeInitIdGenerator,
nativeCreateId,
nativeGetTimestamp,
genString,
IdConvertType,
convertId,
} = nativeBinding;
module.exports.EnvConfig = EnvConfig; module.exports.EnvConfig = EnvConfig
module.exports.readEnvironmentConfig = readEnvironmentConfig; module.exports.readEnvironmentConfig = readEnvironmentConfig
module.exports.readServerConfig = readServerConfig; module.exports.readServerConfig = readServerConfig
module.exports.AntennaSrcEnum = AntennaSrcEnum; module.exports.AntennaSrcEnum = AntennaSrcEnum
module.exports.MutedNoteReasonEnum = MutedNoteReasonEnum; module.exports.MutedNoteReasonEnum = MutedNoteReasonEnum
module.exports.NoteVisibilityEnum = NoteVisibilityEnum; module.exports.NoteVisibilityEnum = NoteVisibilityEnum
module.exports.NotificationTypeEnum = NotificationTypeEnum; module.exports.NotificationTypeEnum = NotificationTypeEnum
module.exports.PageVisibilityEnum = PageVisibilityEnum; module.exports.PageVisibilityEnum = PageVisibilityEnum
module.exports.PollNotevisibilityEnum = PollNotevisibilityEnum; module.exports.PollNotevisibilityEnum = PollNotevisibilityEnum
module.exports.RelayStatusEnum = RelayStatusEnum; module.exports.RelayStatusEnum = RelayStatusEnum
module.exports.UserEmojimodpermEnum = UserEmojimodpermEnum; module.exports.UserEmojimodpermEnum = UserEmojimodpermEnum
module.exports.UserProfileFfvisibilityEnum = UserProfileFfvisibilityEnum; module.exports.UserProfileFfvisibilityEnum = UserProfileFfvisibilityEnum
module.exports.UserProfileMutingnotificationtypesEnum = module.exports.UserProfileMutingnotificationtypesEnum = UserProfileMutingnotificationtypesEnum
UserProfileMutingnotificationtypesEnum; module.exports.stringToAcct = stringToAcct
module.exports.stringToAcct = stringToAcct; module.exports.acctToString = acctToString
module.exports.acctToString = acctToString; module.exports.getFullApAccount = getFullApAccount
module.exports.getFullApAccount = getFullApAccount; module.exports.isSelfHost = isSelfHost
module.exports.isSelfHost = isSelfHost; module.exports.extractHost = extractHost
module.exports.extractHost = extractHost; module.exports.toPuny = toPuny
module.exports.toPuny = toPuny; module.exports.toPunyOptional = toPunyOptional
module.exports.toPunyOptional = toPunyOptional; module.exports.convertToHiddenPost = convertToHiddenPost
module.exports.convertToHiddenPost = convertToHiddenPost; module.exports.sqlLikeEscape = sqlLikeEscape
module.exports.sqlLikeEscape = sqlLikeEscape; module.exports.safeForSql = safeForSql
module.exports.safeForSql = safeForSql; module.exports.formatMilliseconds = formatMilliseconds
module.exports.formatMilliseconds = formatMilliseconds; module.exports.nativeInitIdGenerator = nativeInitIdGenerator
module.exports.nativeInitIdGenerator = nativeInitIdGenerator; module.exports.nativeCreateId = nativeCreateId
module.exports.nativeCreateId = nativeCreateId; module.exports.nativeGetTimestamp = nativeGetTimestamp
module.exports.nativeGetTimestamp = nativeGetTimestamp; module.exports.genString = genString
module.exports.genString = genString; module.exports.IdConvertType = IdConvertType
module.exports.IdConvertType = IdConvertType; module.exports.convertId = convertId
module.exports.convertId = convertId;

View file

@ -48,9 +48,9 @@ say "Done! We're almost there."
br br
# prevent migration errors # prevent migration errors
if [ ! -f packages/backend/native-utils/built/index.js ]; then if [ ! -f packages/backend-rs/built/index.js ]; then
sadsay 'Something went wrong... Gonnya try fixing that.' sadsay 'Something went wrong... Gonnya try fixing that.'
run 'cp neko/index.js packages/backend/native-utils/built/index.js' run 'cp neko/index.js packages/backend-rs/built/index.js'
br br
else else
say "It's going well so far!" say "It's going well so far!"

View file

@ -3,7 +3,7 @@
This directory contains all of the packages Firefish uses. This directory contains all of the packages Firefish uses.
- `backend`: Main backend code written in TypeScript for NodeJS - `backend`: Main backend code written in TypeScript for NodeJS
- `backend/native-utils`: Backend code written in Rust, bound to NodeJS by [NAPI-RS](https://napi.rs/) - `backend-rs`: Backend code written in Rust, bound to NodeJS by [NAPI-RS](https://napi.rs/)
- `client`: Web interface written in Vue3 and TypeScript - `client`: Web interface written in Vue3 and TypeScript
- `sw`: Web [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) written in TypeScript - `sw`: Web [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) written in TypeScript
- `firefish-js`: TypeScript SDK for both backend and client, also published on [NPM](https://www.npmjs.com/package/firefish-js) for public use - `firefish-js`: TypeScript SDK for both backend and client, also published on [NPM](https://www.npmjs.com/package/firefish-js) for public use

View file

@ -196,6 +196,34 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backend-rs"
version = "0.0.0"
dependencies = [
"async-trait",
"basen",
"cfg-if",
"chrono",
"cuid2",
"idna",
"jsonschema",
"napi",
"napi-build",
"napi-derive",
"once_cell",
"parse-display",
"pretty_assertions",
"rand",
"schemars",
"sea-orm",
"serde",
"serde_json",
"serde_yaml",
"thiserror",
"tokio",
"url",
]
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.69" version = "0.3.69"
@ -1302,34 +1330,6 @@ dependencies = [
"libloading", "libloading",
] ]
[[package]]
name = "native-utils"
version = "0.0.0"
dependencies = [
"async-trait",
"basen",
"cfg-if",
"chrono",
"cuid2",
"idna",
"jsonschema",
"napi",
"napi-build",
"napi-derive",
"once_cell",
"parse-display",
"pretty_assertions",
"rand",
"schemars",
"sea-orm",
"serde",
"serde_json",
"serde_yaml",
"thiserror",
"tokio",
"url",
]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.27.1" version = "0.27.1"

View file

@ -1,6 +1,6 @@
[package] [package]
edition = "2021" edition = "2021"
name = "native-utils" name = "backend-rs"
version = "0.0.0" version = "0.0.0"
[features] [features]

View file

@ -0,0 +1,3 @@
# `backend-rs-android-arm-eabi`
This is the **armv7-linux-androideabi** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-android-arm-eabi", "name": "backend-rs-android-arm-eabi",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"android" "android"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"main": "native-utils.android-arm-eabi.node", "main": "backend-rs.android-arm-eabi.node",
"files": [ "files": [
"native-utils.android-arm-eabi.node" "backend-rs.android-arm-eabi.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-android-arm64`
This is the **aarch64-linux-android** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-android-arm64", "name": "backend-rs-android-arm64",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"android" "android"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "native-utils.android-arm64.node", "main": "backend-rs.android-arm64.node",
"files": [ "files": [
"native-utils.android-arm64.node" "backend-rs.android-arm64.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-darwin-arm64", "name": "backend-rs-darwin-arm64",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"darwin" "darwin"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "native-utils.darwin-arm64.node", "main": "backend-rs.darwin-arm64.node",
"files": [ "files": [
"native-utils.darwin-arm64.node" "backend-rs.darwin-arm64.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-darwin-universal`
This is the **universal-apple-darwin** binary for `backend-rs`

View file

@ -0,0 +1,15 @@
{
"name": "backend-rs-darwin-universal",
"version": "0.0.0",
"os": [
"darwin"
],
"main": "backend-rs.darwin-universal.node",
"files": [
"backend-rs.darwin-universal.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-darwin-x64`
This is the **x86_64-apple-darwin** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-darwin-x64", "name": "backend-rs-darwin-x64",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"darwin" "darwin"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "native-utils.darwin-x64.node", "main": "backend-rs.darwin-x64.node",
"files": [ "files": [
"native-utils.darwin-x64.node" "backend-rs.darwin-x64.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-freebsd-x64`
This is the **x86_64-unknown-freebsd** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-freebsd-x64", "name": "backend-rs-freebsd-x64",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"freebsd" "freebsd"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "native-utils.freebsd-x64.node", "main": "backend-rs.freebsd-x64.node",
"files": [ "files": [
"native-utils.freebsd-x64.node" "backend-rs.freebsd-x64.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-linux-arm-gnueabihf", "name": "backend-rs-linux-arm-gnueabihf",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"linux" "linux"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"main": "native-utils.linux-arm-gnueabihf.node", "main": "backend-rs.linux-arm-gnueabihf.node",
"files": [ "files": [
"native-utils.linux-arm-gnueabihf.node" "backend-rs.linux-arm-gnueabihf.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-linux-arm64-gnu", "name": "backend-rs-linux-arm64-gnu",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"linux" "linux"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "native-utils.linux-arm64-gnu.node", "main": "backend-rs.linux-arm64-gnu.node",
"files": [ "files": [
"native-utils.linux-arm64-gnu.node" "backend-rs.linux-arm64-gnu.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-linux-arm64-musl", "name": "backend-rs-linux-arm64-musl",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"linux" "linux"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "native-utils.linux-arm64-musl.node", "main": "backend-rs.linux-arm64-musl.node",
"files": [ "files": [
"native-utils.linux-arm64-musl.node" "backend-rs.linux-arm64-musl.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-linux-x64-gnu", "name": "backend-rs-linux-x64-gnu",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"linux" "linux"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "native-utils.linux-x64-gnu.node", "main": "backend-rs.linux-x64-gnu.node",
"files": [ "files": [
"native-utils.linux-x64-gnu.node" "backend-rs.linux-x64-gnu.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-linux-x64-musl", "name": "backend-rs-linux-x64-musl",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"linux" "linux"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "native-utils.linux-x64-musl.node", "main": "backend-rs.linux-x64-musl.node",
"files": [ "files": [
"native-utils.linux-x64-musl.node" "backend-rs.linux-x64-musl.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-win32-arm64-msvc", "name": "backend-rs-win32-arm64-msvc",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"win32" "win32"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"main": "native-utils.win32-arm64-msvc.node", "main": "backend-rs.win32-arm64-msvc.node",
"files": [ "files": [
"native-utils.win32-arm64-msvc.node" "backend-rs.win32-arm64-msvc.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-win32-ia32-msvc", "name": "backend-rs-win32-ia32-msvc",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"win32" "win32"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
"main": "native-utils.win32-ia32-msvc.node", "main": "backend-rs.win32-ia32-msvc.node",
"files": [ "files": [
"native-utils.win32-ia32-msvc.node" "backend-rs.win32-ia32-msvc.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -0,0 +1,3 @@
# `backend-rs-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{ {
"name": "native-utils-win32-x64-msvc", "name": "backend-rs-win32-x64-msvc",
"version": "0.0.0", "version": "0.0.0",
"os": [ "os": [
"win32" "win32"
@ -7,9 +7,9 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"main": "native-utils.win32-x64-msvc.node", "main": "backend-rs.win32-x64-msvc.node",
"files": [ "files": [
"native-utils.win32-x64-msvc.node" "backend-rs.win32-x64-msvc.node"
], ],
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View file

@ -1,10 +1,10 @@
{ {
"name": "native-utils", "name": "backend-rs",
"version": "0.0.0", "version": "0.0.0",
"main": "built/index.js", "main": "built/index.js",
"types": "built/index.d.ts", "types": "built/index.d.ts",
"napi": { "napi": {
"name": "native-utils", "name": "backend-rs",
"triples": { "triples": {
"additional": [ "additional": [
"aarch64-apple-darwin", "aarch64-apple-darwin",

Some files were not shown because too many files have changed in this diff Show more