mobile: fix build failing

This commit is contained in:
Ammar Ahmed
2024-09-24 13:14:23 +05:00
parent 8b207b47dd
commit e81580024e
18 changed files with 212 additions and 320 deletions

View File

@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import Sodium from "@ammarahmed/react-native-sodium";
import dataurl from "@notesnook/core";
import type { ImageAttributes } from "@notesnook/editor/dist/extensions/image/index";
import { DataURL } from "@notesnook/core";
import type { ImageAttributes } from "@notesnook/editor";
import { useThemeColors } from "@notesnook/theme";
import React, { useEffect, useRef, useState } from "react";
import { Platform, View } from "react-native";
@@ -55,8 +55,8 @@ const ImagePreview = () => {
setLoading(true);
setTimeout(async () => {
let hash = image.hash;
if (!hash && image.src && dataurl.toObject(image.src)) {
const data = dataurl.toObject(image.src);
if (!hash && image.src && DataURL.toObject(image.src)) {
const data = DataURL.toObject(image.src);
if (!data) return;
hash = await Sodium.hashFile({
data: data.data,

View File

@@ -34,7 +34,7 @@ import { Button } from "../../ui/button";
import Input from "../../ui/input";
import { Pressable } from "../../ui/pressable";
import Paragraph from "../../ui/typography/paragraph";
import type { LinkAttributes } from "@notesnook/editor/dist/extensions/link";
import type { LinkAttributes } from "@notesnook/editor";
import {
EditorEvents,
editorController

View File

@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Note } from "@notesnook/core";
import type { Attachment } from "@notesnook/editor/dist/extensions/attachment/index";
import type { ImageAttributes } from "@notesnook/editor/dist/extensions/image/index";
import type { LinkAttributes } from "@notesnook/editor/dist/extensions/link";
import type { Attachment } from "@notesnook/editor";
import type { ImageAttributes } from "@notesnook/editor";
import type { LinkAttributes } from "@notesnook/editor";
import { createRef, RefObject } from "react";
import { Platform } from "react-native";
import { EdgeInsets } from "react-native-safe-area-context";

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type { ToolbarGroupDefinition } from "@notesnook/editor/dist/toolbar/types";
import type { ToolbarGroupDefinition } from "@notesnook/editor";
import { useEditor } from "./use-editor";
export type useEditorType = ReturnType<typeof useEditor>;

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable no-case-declarations */
/* eslint-disable @typescript-eslint/no-var-requires */
import { ItemReference } from "@notesnook/core";
import type { Attachment } from "@notesnook/editor/dist/extensions/attachment/index";
import type { Attachment } from "@notesnook/editor";
import { getDefaultPresets } from "@notesnook/editor/dist/toolbar/tool-definitions";
import Clipboard from "@react-native-clipboard/clipboard";
import React, { useCallback, useEffect, useRef } from "react";

View File

@@ -32,7 +32,7 @@ import { DraggableItem, useDragState } from "./state";
import ToolSheet from "./tool-sheet";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { ToolId } from "@notesnook/editor/dist/toolbar/tools";
import type { ToolId } from "@notesnook/editor";
import PremiumService from "../../../services/premium";
export const Group = ({

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { CURRENT_TOOLBAR_VERSION, migrateToolbar } from "@notesnook/common";
import type { ToolbarGroupDefinition } from "@notesnook/editor/dist/toolbar/types";
import type { ToolbarGroupDefinition } from "@notesnook/editor";
import create, { State } from "zustand";
import { StateStorage, persist } from "zustand/middleware";
import { db } from "../../../common/database";

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ToolId } from "@notesnook/editor/dist/toolbar";
import type { ToolId } from "@notesnook/editor";
import React, { RefObject } from "react";
import { View } from "react-native";
import { Pressable } from "../../../components/ui/pressable";

View File

@@ -34,7 +34,7 @@ import { findToolById, getToolIcon } from "./toolbar-definition";
import ToolSheet from "./tool-sheet";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { ToolId } from "@notesnook/editor/dist/toolbar/tools";
import type { ToolId } from "@notesnook/editor";
import PremiumService from "../../../services/premium";
export const Tool = ({

View File

@@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Icons } from "@notesnook/editor/dist/toolbar/icons";
import { ToolbarGroupDefinition } from "@notesnook/editor/dist/toolbar/index";
import { ToolbarGroupDefinition } from "@notesnook/editor";
import {
getAllTools,
getDefaultPresets
} from "@notesnook/editor/dist/toolbar/tool-definitions";
import { ToolId } from "@notesnook/editor/dist/toolbar/tools";
import { ToolId } from "@notesnook/editor";
export const tools = getAllTools();
export const presets: { [name: string]: ToolbarGroupDefinition[] } = {

View File

@@ -17,16 +17,16 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { DATE_FORMATS, TIME_FORMATS } from "@notesnook/core";
import { getFontById, getFonts } from "@notesnook/editor/dist/utils/font";
import dayjs from "dayjs";
import { createSettingsPicker } from ".";
import { db } from "../../../common/database";
import { ToastManager } from "../../../services/event-manager";
import SettingsService from "../../../services/settings";
import { useSettingStore } from "../../../stores/use-setting-store";
import { MenuItemsList } from "../../../utils/menu-items";
import { createSettingsPicker } from ".";
import { getFontById, getFonts } from "@notesnook/editor/dist/utils/font";
import { DATE_FORMATS, TIME_FORMATS } from "@notesnook/core";
import dayjs from "dayjs";
import { useUserStore } from "../../../stores/use-user-store";
import { MenuItemsList } from "../../../utils/menu-items";
import { verifyUserWithApplock } from "../functions";
export const FontPicker = createSettingsPicker({

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import EventManager, { EventHandler } from "@notesnook/core";
import { EventHandler, EventManager } from "@notesnook/core";
import Clipboard from "@react-native-clipboard/clipboard";
import { RefObject } from "react";
import { ActionSheetRef } from "react-native-actions-sheet";

View File

@@ -37,6 +37,13 @@ mergedConfig.resolver = {
type:"empty"
}
}
if (moduleName === "crypto") {
return {
type:"empty"
}
}
if (moduleName ==='react') {
// Resolve react package from mobile app's node_modules folder always.
return {

File diff suppressed because it is too large Load Diff

View File

@@ -134,15 +134,17 @@
},
"../../packages/common": {
"name": "@notesnook/common",
"version": "2.0.7",
"version": "2.1.3",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/core": "^8.0.0",
"@notesnook/core": "file:../core",
"@readme/data-urls": "^3.0.0",
"dayjs": "^1.11.13",
"pathe": "^1.1.2",
"timeago.js": "4.0.2"
},
"devDependencies": {
"@notesnook/core": "^8.0.0",
"@notesnook/core": "file:../core",
"@types/react": "^18.2.39",
"react": "18.2.0",
"vitest": "^1.4.0"
@@ -330,14 +332,14 @@
},
"../../packages/theme": {
"name": "@notesnook/theme",
"version": "2.0.7",
"version": "2.1.3",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@emotion/react": "11.11.1",
"@theme-ui/color": "^0.16.1",
"@theme-ui/components": "^0.16.1",
"@theme-ui/core": "^0.16.1",
"@trpc/server": "^10.31.0",
"@trpc/server": "^10.45.2",
"@types/react": "^18.2.39",
"@types/tinycolor2": "^1.4.3",
"isomorphic-fetch": "^3.0.0",

View File

@@ -33,7 +33,7 @@
},
"../../packages/crypto": {
"name": "@notesnook/crypto",
"version": "2.0.7",
"version": "2.1.3",
"license": "GPL-3.0-or-later",
"dependencies": {
"@notesnook/sodium": "file:../sodium"

View File

@@ -34,7 +34,7 @@
},
"../editor": {
"name": "@notesnook/editor",
"version": "2.1.1",
"version": "2.1.3",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -128,7 +128,7 @@
},
"../theme": {
"name": "@notesnook/theme",
"version": "2.1.1",
"version": "2.1.3",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@emotion/react": "11.11.1",
@@ -4381,7 +4381,7 @@
"version": "15.7.11",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz",
"integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==",
"devOptional": true
"dev": true
},
"node_modules/@types/q": {
"version": "1.5.8",
@@ -4405,7 +4405,7 @@
"version": "18.2.39",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.39.tgz",
"integrity": "sha512-Oiw+ppED6IremMInLV4HXGbfbG6GyziY3kqAwJYOR0PNbkYDmLWQA3a95EhdSmamsvbkJN96ZNN+YD+fGjzSBA==",
"devOptional": true,
"dev": true,
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@@ -4440,7 +4440,7 @@
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
"devOptional": true
"dev": true
},
"node_modules/@types/semver": {
"version": "7.5.6",
@@ -9725,7 +9725,7 @@
"version": "9.0.21",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==",
"devOptional": true,
"dev": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/immer"
@@ -17811,20 +17811,6 @@
"is-typedarray": "^1.0.0"
}
},
"node_modules/typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"dev": true,
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",

View File

@@ -15,7 +15,9 @@
"default": "./dist/index.mjs"
}
},
"./styles/*.css": "./dist/styles/*.css"
"./styles/*.css": "./dist/styles/*.css",
"./tools": "./src/toolbar/tool-definitions.ts",
"./fonts": "./src/utils/font.ts"
},
"license": "GPL-3.0-or-later",
"dependencies": {
@@ -114,7 +116,7 @@
"start": "npm run watch",
"prepublishOnly": "npm run build && npm run test",
"postinstall": "patch-package",
"build": "tsup-node src/index.ts",
"build": "tsup-node src/index.ts src/utils/font.ts src/toolbar/tool-definitions.ts src/toolbar/icons.ts",
"watch": "npm run build -- --watch"
},
"repository": {