Firefish v1.0.5-dev18
This commit is contained in:
parent
56c64d5860
commit
dee4497e69
259 changed files with 1526 additions and 12180 deletions
packages/sw
|
@ -2,7 +2,7 @@
|
|||
"name": "sw",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"build": "pnpm vite build --emptyOutDir",
|
||||
"build:debug": "pnpm run build",
|
||||
"watch": "pnpm swc src -d built -D -w",
|
||||
"lint": "pnpm biome check **/*.ts --apply",
|
||||
|
@ -14,8 +14,10 @@
|
|||
"@swc/core-android-arm64": "1.3.11",
|
||||
"firefish-js": "workspace:*",
|
||||
"idb-keyval": "^6.2.1",
|
||||
"swc-loader": "^0.2.3",
|
||||
"webpack": "^5.85.1",
|
||||
"webpack-cli": "^5.1.3"
|
||||
"vite": "4.4.9",
|
||||
"vite-plugin-compression": "^0.5.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@swc/core-android-arm64": "1.3.11"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
* Operations
|
||||
* 各種操作
|
||||
*/
|
||||
import * as Misskey from "firefish-js";
|
||||
import * as firefish from "firefish-js";
|
||||
import type { SwMessage, SwMessageOrderType } from "@/types";
|
||||
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
||||
import { getUrlWithLoginId } from "@/scripts/login-id";
|
||||
|
||||
export const cli = new Misskey.api.APIClient({
|
||||
export const cli = new firefish.api.APIClient({
|
||||
origin,
|
||||
fetch: (...args): Promise<Response> => fetch(...args),
|
||||
});
|
||||
|
||||
export async function api<
|
||||
E extends keyof Misskey.Endpoints,
|
||||
O extends Misskey.Endpoints[E]["req"],
|
||||
E extends keyof firefish.Endpoints,
|
||||
O extends firefish.Endpoints[E]["req"],
|
||||
>(
|
||||
endpoint: E,
|
||||
userId?: string,
|
||||
|
@ -75,8 +75,8 @@ export function openAntenna(
|
|||
export async function openPost(
|
||||
options: {
|
||||
initialText?: string;
|
||||
reply?: Misskey.entities.Note;
|
||||
renote?: Misskey.entities.Note;
|
||||
reply?: firefish.entities.Note;
|
||||
renote?: firefish.entities.Note;
|
||||
},
|
||||
loginId?: string,
|
||||
): ReturnType<typeof openClient> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as Misskey from "firefish-js";
|
||||
import * as firefish from "firefish-js";
|
||||
|
||||
export type SwMessageOrderType = "post" | "push";
|
||||
|
||||
|
@ -12,10 +12,10 @@ export type SwMessage = {
|
|||
|
||||
// Defined also @/services/push-notification.ts#L7-L14
|
||||
type PushNotificationDataSourceMap = {
|
||||
notification: Misskey.entities.Notification;
|
||||
notification: firefish.entities.Notification;
|
||||
unreadAntennaNote: {
|
||||
antenna: { id: string; name: string };
|
||||
note: Misskey.entities.Note;
|
||||
note: firefish.entities.Note;
|
||||
};
|
||||
readAllNotifications: undefined;
|
||||
readAllMessagingMessages: undefined;
|
||||
|
|
53
packages/sw/vite.config.ts
Normal file
53
packages/sw/vite.config.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
import { defineConfig } from "vite";
|
||||
const locales = require("../../locales");
|
||||
const meta = require("../../package.json");
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
|
||||
export default defineConfig({
|
||||
mode: isProduction ? "production" : "development",
|
||||
build: {
|
||||
target: ["chrome87", "firefox78", "safari14", "es2017"],
|
||||
manifest: "manifest.json",
|
||||
rollupOptions: {
|
||||
input: {
|
||||
app: "./src/sw.ts",
|
||||
},
|
||||
output: {
|
||||
entryFileNames: "sw.js",
|
||||
},
|
||||
},
|
||||
cssCodeSplit: true,
|
||||
assetsInlineLimit: 0,
|
||||
outDir: `${__dirname}/../../built/_sw_dist_`,
|
||||
assetsDir: ".",
|
||||
emptyOutDir: false,
|
||||
sourcemap: process.env.NODE_ENV === "development",
|
||||
reportCompressedSize: false,
|
||||
commonjsOptions: {
|
||||
include: [/firefish-js/, /node_modules/],
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@/": `${__dirname}/src/`,
|
||||
},
|
||||
extensions: [".js", ".ts"],
|
||||
},
|
||||
define: {
|
||||
_VERSION_: JSON.stringify(meta.version),
|
||||
_LANGS_: JSON.stringify(
|
||||
Object.entries(locales).map(([k, v]) => [k, v._lang_]),
|
||||
),
|
||||
_ENV_: JSON.stringify(process.env.NODE_ENV),
|
||||
_DEV_: !isProduction,
|
||||
_PERF_PREFIX_: JSON.stringify("Firefish:"),
|
||||
},
|
||||
plugins: [
|
||||
viteCompression({
|
||||
algorithm: "brotliCompress",
|
||||
verbose: false,
|
||||
}),
|
||||
],
|
||||
});
|
|
@ -1,50 +0,0 @@
|
|||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
const locales = require("../../locales");
|
||||
const meta = require("../../package.json");
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
|
||||
module.exports = {
|
||||
mode: isProduction ? "production" : "development",
|
||||
stats: "errors-only",
|
||||
entry: "./src/sw.ts",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "../../built/_sw_dist_"),
|
||||
filename: "sw.js",
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".js", ".ts"],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: "swc-loader",
|
||||
options: {
|
||||
// This makes swc-loader invoke swc synchronously.
|
||||
sync: true,
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: "typescript",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
_VERSION_: JSON.stringify(meta.version),
|
||||
_LANGS_: JSON.stringify(
|
||||
Object.entries(locales).map(([k, v]) => [k, v._lang_]),
|
||||
),
|
||||
_ENV_: JSON.stringify(process.env.NODE_ENV),
|
||||
_DEV_: !isProduction,
|
||||
_PERF_PREFIX_: JSON.stringify("Firefish:"),
|
||||
}),
|
||||
],
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue