@epubjs-react-native/file-system 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
42
  });
10
43
  };
11
44
  var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
45
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
47
  function verb(n) { return function (v) { return step([n, v]); }; }
15
48
  function step(op) {
16
49
  if (f) throw new TypeError("Generator is already executing.");
@@ -35,13 +68,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
68
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
69
  }
37
70
  };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
71
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.useFileSystem = void 0;
72
+ exports.useFileSystem = useFileSystem;
43
73
  var react_1 = require("react");
44
- var react_native_fs_1 = __importDefault(require("react-native-fs"));
74
+ var RNFS = __importStar(require("@dr.pogodin/react-native-fs"));
45
75
  function useFileSystem() {
46
76
  var _this = this;
47
77
  var _a = (0, react_1.useState)(null), file = _a[0], setFile = _a[1];
@@ -51,8 +81,8 @@ function useFileSystem() {
51
81
  var _e = (0, react_1.useState)(null), error = _e[0], setError = _e[1];
52
82
  var _f = (0, react_1.useState)(false), success = _f[0], setSuccess = _f[1];
53
83
  var downloadFile = (0, react_1.useCallback)(function (fromUrl, toFile) {
54
- var toFilePath = "".concat(react_native_fs_1.default.CachesDirectoryPath, "/").concat(toFile);
55
- return react_native_fs_1.default.downloadFile({
84
+ var toFilePath = "".concat(RNFS.CachesDirectoryPath, "/").concat(toFile);
85
+ return RNFS.downloadFile({
56
86
  fromUrl: fromUrl,
57
87
  toFile: toFilePath,
58
88
  begin: function (_a) {
@@ -72,7 +102,7 @@ function useFileSystem() {
72
102
  switch (_d.label) {
73
103
  case 0:
74
104
  if (!(statusCode === 200)) return [3 /*break*/, 2];
75
- return [4 /*yield*/, react_native_fs_1.default.stat(toFilePath)];
105
+ return [4 /*yield*/, RNFS.stat(toFilePath)];
76
106
  case 1:
77
107
  _c = _d.sent(), filePath = _c.path, fileSize = _c.size;
78
108
  setFile(filePath);
@@ -107,10 +137,10 @@ function useFileSystem() {
107
137
  var exists, _a, uri, isDirectoryFn, fileSize, isDirectory;
108
138
  return __generator(this, function (_b) {
109
139
  switch (_b.label) {
110
- case 0: return [4 /*yield*/, react_native_fs_1.default.exists(fileUri)];
140
+ case 0: return [4 /*yield*/, RNFS.exists(fileUri)];
111
141
  case 1:
112
142
  exists = _b.sent();
113
- return [4 /*yield*/, react_native_fs_1.default.stat(fileUri)];
143
+ return [4 /*yield*/, RNFS.stat(fileUri)];
114
144
  case 2:
115
145
  _a = _b.sent(), uri = _a.path, isDirectoryFn = _a.isDirectory, fileSize = _a.size;
116
146
  isDirectory = isDirectoryFn();
@@ -130,18 +160,17 @@ function useFileSystem() {
130
160
  size: size,
131
161
  error: error,
132
162
  success: success,
133
- documentDirectory: react_native_fs_1.default.DocumentDirectoryPath,
134
- bundleDirectory: react_native_fs_1.default.MainBundlePath,
135
- cacheDirectory: react_native_fs_1.default.CachesDirectoryPath,
163
+ documentDirectory: RNFS.DocumentDirectoryPath,
164
+ bundleDirectory: RNFS.MainBundlePath,
165
+ cacheDirectory: RNFS.CachesDirectoryPath,
136
166
  readAsStringAsync: function (fileUri, options) {
137
- return react_native_fs_1.default.readFile(fileUri, options === null || options === void 0 ? void 0 : options.encoding);
167
+ return RNFS.readFile(fileUri, options === null || options === void 0 ? void 0 : options.encoding);
138
168
  },
139
169
  writeAsStringAsync: function (fileUri, contents, options) {
140
- return react_native_fs_1.default.writeFile(fileUri, contents, options === null || options === void 0 ? void 0 : options.encoding);
170
+ return RNFS.writeFile(fileUri, contents, options === null || options === void 0 ? void 0 : options.encoding);
141
171
  },
142
- deleteAsync: function (fileUri) { return react_native_fs_1.default.unlink(fileUri); },
172
+ deleteAsync: function (fileUri) { return RNFS.unlink(fileUri); },
143
173
  downloadFile: downloadFile,
144
174
  getFileInfo: getFileInfo,
145
175
  };
146
176
  }
147
- exports.useFileSystem = useFileSystem;
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
@@ -35,7 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { useCallback, useState } from 'react';
38
- import RNFS from 'react-native-fs';
38
+ import * as RNFS from '@dr.pogodin/react-native-fs';
39
39
  export function useFileSystem() {
40
40
  var _this = this;
41
41
  var _a = useState(null), file = _a[0], setFile = _a[1];
@@ -20,7 +20,7 @@ export type FileSystem = {
20
20
  /**
21
21
  * URI to the directory where assets bundled with the application are stored.
22
22
  */
23
- bundleDirectory: string | null;
23
+ bundleDirectory: string | undefined;
24
24
  readAsStringAsync: (fileUri: string, options?: {
25
25
  /**
26
26
  * The encoding format to use when reading the file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epubjs-react-native/file-system",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "An file system module for epubjs-react-native library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -48,35 +48,35 @@
48
48
  },
49
49
  "homepage": "https://github.com/victorsoares96/epubjs-react-native-file-system#readme",
50
50
  "resolutions": {
51
- "@types/react": "18.2.66"
51
+ "@types/react": "18.3.18"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": "*",
55
- "react-native-fs": "2.20.0"
55
+ "@dr.pogodin/react-native-fs": "*"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/jest": "29.5.12",
59
- "@types/react": "18.2.66",
60
- "@typescript-eslint/eslint-plugin": "7.2.0",
61
- "@typescript-eslint/parser": "7.2.0",
62
- "commitizen": "4.3.0",
58
+ "@dr.pogodin/react-native-fs": "^2.30.3",
59
+ "@types/jest": "29.5.14",
60
+ "@types/react": "18.3.18",
61
+ "@typescript-eslint/eslint-plugin": "7.18.0",
62
+ "@typescript-eslint/parser": "7.18.0",
63
+ "commitizen": "4.3.1",
63
64
  "commitizen-emoji": "1.0.5",
64
65
  "copyfiles": "2.4.1",
65
- "eslint": "8.57.0",
66
+ "eslint": "8.57.1",
66
67
  "eslint-config-airbnb-base": "15.0.0",
67
68
  "eslint-config-airbnb-typescript": "18.0.0",
68
- "eslint-config-prettier": "9.1.0",
69
- "eslint-plugin-import": "2.29.1",
70
- "eslint-plugin-prettier": "5.1.3",
71
- "husky": "9.0.11",
69
+ "eslint-config-prettier": "10.0.1",
70
+ "eslint-plugin-import": "2.31.0",
71
+ "eslint-plugin-prettier": "5.2.3",
72
+ "husky": "9.1.7",
72
73
  "jest": "29.7.0",
73
- "lint-staged": "15.2.2",
74
- "prettier": "3.2.5",
75
- "react": "18.2.0",
76
- "rimraf": "5.0.5",
77
- "react-native-fs": "2.20.0",
78
- "ts-jest": "29.1.2",
79
- "typescript": "5.4.2"
74
+ "lint-staged": "15.4.3",
75
+ "prettier": "3.4.2",
76
+ "react": "18.3.1",
77
+ "rimraf": "6.0.1",
78
+ "ts-jest": "29.2.5",
79
+ "typescript": "5.7.3"
80
80
  },
81
81
  "config": {
82
82
  "commitizen": {