1
0
Fork 1
mirror of https://example.com synced 2024-11-22 01:26:39 +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
# Rust
packages/backend/native-utils/target
packages/backend-rs/target
# Cypress
cypress/screenshots

View file

@ -15,12 +15,12 @@ RUN <<EOC
EOC
# 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/native-utils/Cargo.lock packages/backend/native-utils/Cargo.lock
COPY packages/backend/native-utils/src/lib.rs packages/backend/native-utils/src/
COPY packages/backend-rs/Cargo.toml packages/backend-rs/Cargo.toml
COPY packages/backend-rs/Cargo.lock packages/backend-rs/Cargo.lock
COPY packages/backend-rs/src/lib.rs packages/backend-rs/src/
# 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 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/firefish-js/package.json packages/firefish-js/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/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/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/package.json packages/backend-rs/package.json
COPY packages/backend-rs/npm/linux-x64-musl/package.json packages/backend-rs/npm/linux-x64-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
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm install --frozen-lockfile
# Copy in the rest of the native-utils rust files
COPY packages/backend/native-utils packages/backend/native-utils/
# Copy in the rest of the rust files
COPY packages/backend-rs packages/backend-rs/
# Compile native-utils
RUN pnpm run --filter native-utils build
# Compile backend-rs
RUN pnpm run --filter backend-rs build
# Copy in the rest of the files to compile
COPY . ./
@ -51,7 +51,7 @@ ENV VERSION=${VERSION}
RUN pnpm pkg set version="${VERSION}"
# 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
RUN pnpm install --prod --frozen-lockfile
@ -73,6 +73,7 @@ COPY --from=build /firefish/packages/megalodon /firefish/packages/megalodon
# Copy 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-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/client/node_modules /firefish/packages/client/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/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/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
ARG VERSION

View file

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

View file

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

View file

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

View file

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

View file

@ -48,9 +48,9 @@ say "Done! We're almost there."
br
# 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.'
run 'cp neko/index.js packages/backend/native-utils/built/index.js'
run 'cp neko/index.js packages/backend-rs/built/index.js'
br
else
say "It's going well so far!"

View file

@ -3,7 +3,7 @@
This directory contains all of the packages Firefish uses.
- `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
- `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

View file

@ -196,6 +196,34 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "backtrace"
version = "0.3.69"
@ -1302,34 +1330,6 @@ dependencies = [
"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]]
name = "nix"
version = "0.27.1"

View file

@ -1,6 +1,6 @@
[package]
edition = "2021"
name = "native-utils"
name = "backend-rs"
version = "0.0.0"
[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",
"os": [
"android"
@ -7,9 +7,9 @@
"cpu": [
"arm"
],
"main": "native-utils.android-arm-eabi.node",
"main": "backend-rs.android-arm-eabi.node",
"files": [
"native-utils.android-arm-eabi.node"
"backend-rs.android-arm-eabi.node"
],
"license": "MIT",
"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",
"os": [
"android"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.android-arm64.node",
"main": "backend-rs.android-arm64.node",
"files": [
"native-utils.android-arm64.node"
"backend-rs.android-arm64.node"
],
"license": "MIT",
"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",
"os": [
"darwin"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.darwin-arm64.node",
"main": "backend-rs.darwin-arm64.node",
"files": [
"native-utils.darwin-arm64.node"
"backend-rs.darwin-arm64.node"
],
"license": "MIT",
"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",
"os": [
"darwin"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.darwin-x64.node",
"main": "backend-rs.darwin-x64.node",
"files": [
"native-utils.darwin-x64.node"
"backend-rs.darwin-x64.node"
],
"license": "MIT",
"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",
"os": [
"freebsd"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.freebsd-x64.node",
"main": "backend-rs.freebsd-x64.node",
"files": [
"native-utils.freebsd-x64.node"
"backend-rs.freebsd-x64.node"
],
"license": "MIT",
"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",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"arm"
],
"main": "native-utils.linux-arm-gnueabihf.node",
"main": "backend-rs.linux-arm-gnueabihf.node",
"files": [
"native-utils.linux-arm-gnueabihf.node"
"backend-rs.linux-arm-gnueabihf.node"
],
"license": "MIT",
"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",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.linux-arm64-gnu.node",
"main": "backend-rs.linux-arm64-gnu.node",
"files": [
"native-utils.linux-arm64-gnu.node"
"backend-rs.linux-arm64-gnu.node"
],
"license": "MIT",
"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",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.linux-arm64-musl.node",
"main": "backend-rs.linux-arm64-musl.node",
"files": [
"native-utils.linux-arm64-musl.node"
"backend-rs.linux-arm64-musl.node"
],
"license": "MIT",
"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",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.linux-x64-gnu.node",
"main": "backend-rs.linux-x64-gnu.node",
"files": [
"native-utils.linux-x64-gnu.node"
"backend-rs.linux-x64-gnu.node"
],
"license": "MIT",
"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",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.linux-x64-musl.node",
"main": "backend-rs.linux-x64-musl.node",
"files": [
"native-utils.linux-x64-musl.node"
"backend-rs.linux-x64-musl.node"
],
"license": "MIT",
"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",
"os": [
"win32"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.win32-arm64-msvc.node",
"main": "backend-rs.win32-arm64-msvc.node",
"files": [
"native-utils.win32-arm64-msvc.node"
"backend-rs.win32-arm64-msvc.node"
],
"license": "MIT",
"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",
"os": [
"win32"
@ -7,9 +7,9 @@
"cpu": [
"ia32"
],
"main": "native-utils.win32-ia32-msvc.node",
"main": "backend-rs.win32-ia32-msvc.node",
"files": [
"native-utils.win32-ia32-msvc.node"
"backend-rs.win32-ia32-msvc.node"
],
"license": "MIT",
"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",
"os": [
"win32"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.win32-x64-msvc.node",
"main": "backend-rs.win32-x64-msvc.node",
"files": [
"native-utils.win32-x64-msvc.node"
"backend-rs.win32-x64-msvc.node"
],
"license": "MIT",
"engines": {

View file

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

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