@peers-app/peers-sdk 0.11.1 → 0.11.2

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.
@@ -7,7 +7,6 @@ declare const schema: z.ZodObject<{
7
7
  name: z.ZodString;
8
8
  description: z.ZodString;
9
9
  createdBy: z.ZodEffects<z.ZodString, string, string>;
10
- localPath: z.ZodString;
11
10
  disabled: z.ZodOptional<z.ZodBoolean>;
12
11
  remoteRepo: z.ZodOptional<z.ZodString>;
13
12
  appNavs: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -36,7 +35,6 @@ declare const schema: z.ZodObject<{
36
35
  signature: string;
37
36
  createdBy: string;
38
37
  packageId: string;
39
- localPath: string;
40
38
  disabled?: boolean | undefined;
41
39
  appNavs?: {
42
40
  name: string;
@@ -54,7 +52,6 @@ declare const schema: z.ZodObject<{
54
52
  signature: string;
55
53
  createdBy: string;
56
54
  packageId: string;
57
- localPath: string;
58
55
  disabled?: boolean | undefined;
59
56
  appNavs?: {
60
57
  name: string;
@@ -51,7 +51,6 @@ const schema = zod_1.z.object({
51
51
  name: zod_1.z.string(),
52
52
  description: zod_1.z.string(),
53
53
  createdBy: zod_types_1.zodPeerId.describe('The user who created the package'),
54
- localPath: zod_1.z.string().describe('The local path where the package is stored'),
55
54
  disabled: zod_1.z.boolean().optional().describe("Whether the package's components should be loaded and included in the app runtime"),
56
55
  remoteRepo: zod_1.z.string().optional().describe('The remote repository where the package is stored'),
57
56
  appNavs: app_nav_1.appNavSchema.array().optional().describe('The app navigation items that this package provides'),
@@ -13,6 +13,7 @@ export declare class PackageLoader {
13
13
  }): Promise<void>;
14
14
  loadPackage(pkg: IPackage, opts?: {
15
15
  force?: boolean;
16
+ localPath?: string;
16
17
  }): Promise<IPeersPackage | undefined>;
17
18
  private _readLocalBundle;
18
19
  private _evaluateBundle;
@@ -29,6 +29,7 @@ class PackageLoader {
29
29
  if (this.packageInstances[pkg.packageId] && !opts?.force) {
30
30
  return this.packageInstances[pkg.packageId];
31
31
  }
32
+ const localPath = opts?.localPath;
32
33
  try {
33
34
  let bundleCode = '';
34
35
  let bundleFileId;
@@ -55,8 +56,8 @@ class PackageLoader {
55
56
  console.warn(`Package ${pkg.name} does not have a bundle file defined.`);
56
57
  }
57
58
  // Fallback: try loading from local path if stored bundle is not available
58
- if (!bundleCode && pkg.localPath) {
59
- bundleCode = this._readLocalBundle(pkg) ?? '';
59
+ if (!bundleCode && localPath) {
60
+ bundleCode = this._readLocalBundle(localPath) ?? '';
60
61
  }
61
62
  if (!bundleCode)
62
63
  return;
@@ -64,10 +65,10 @@ class PackageLoader {
64
65
  }
65
66
  catch (err) {
66
67
  // If stored bundle failed to evaluate, try local path as fallback
67
- if (pkg.localPath) {
68
+ if (localPath) {
68
69
  console.warn(`[PackageLoader] Stored bundle failed for ${pkg.name}, trying local path fallback`, err.message);
69
70
  try {
70
- const localBundleCode = this._readLocalBundle(pkg);
71
+ const localBundleCode = this._readLocalBundle(localPath);
71
72
  if (localBundleCode) {
72
73
  return this._evaluateBundle(pkg, localBundleCode);
73
74
  }
@@ -80,14 +81,14 @@ class PackageLoader {
80
81
  return;
81
82
  }
82
83
  }
83
- _readLocalBundle(pkg) {
84
+ _readLocalBundle(localPath) {
84
85
  try {
85
86
  const _require = this.require ?? defaultRequire ?? (typeof require === 'function' ? require : null);
86
- if (!_require || !pkg.localPath)
87
+ if (!_require || !localPath)
87
88
  return;
88
89
  const fs = _require('fs');
89
90
  const path = _require('path');
90
- return fs.readFileSync(path.join(pkg.localPath, 'dist', 'package.bundle.js'), 'utf8');
91
+ return fs.readFileSync(path.join(localPath, 'dist', 'package.bundle.js'), 'utf8');
91
92
  }
92
93
  catch {
93
94
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-sdk",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/peers-app/peers-sdk.git"