@nexushub/client 0.4.2 → 0.4.3

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,6 +1,28 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
19
 
3
20
  // src/content/local-cache-client.ts
21
+ var local_cache_client_exports = {};
22
+ __export(local_cache_client_exports, {
23
+ LocalCache: () => LocalCache
24
+ });
25
+ module.exports = __toCommonJS(local_cache_client_exports);
4
26
  var LocalCache = class {
5
27
  constructor(customPath) {
6
28
  // Maintain private properties for type parity with the Server version
@@ -56,6 +78,7 @@ var LocalCache = class {
56
78
  return !isMissing || isMalformed;
57
79
  }
58
80
  };
59
-
60
-
61
- exports.LocalCache = LocalCache;
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ LocalCache
84
+ });
@@ -1,5 +1,3 @@
1
- "use client";
2
-
3
1
  // src/content/local-cache-client.ts
4
2
  var LocalCache = class {
5
3
  constructor(customPath) {
@@ -1,28 +1,60 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }"use client";
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
29
 
3
30
  // src/content/local-cache-server.ts
4
- var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
5
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
31
+ var local_cache_server_exports = {};
32
+ __export(local_cache_server_exports, {
33
+ LocalCache: () => LocalCache
34
+ });
35
+ module.exports = __toCommonJS(local_cache_server_exports);
36
+ var import_fs = __toESM(require("fs"), 1);
37
+ var import_path = __toESM(require("path"), 1);
6
38
  var LocalCache = class {
7
39
  constructor(customPath) {
8
40
  this.baseDir = customPath || ".nexus/local";
9
41
  }
10
42
  isLoaded() {
11
- return _fs2.default.existsSync(_path2.default.resolve(process.cwd(), this.baseDir));
43
+ return import_fs.default.existsSync(import_path.default.resolve(process.cwd(), this.baseDir));
12
44
  }
13
45
  /**
14
46
  * Retrieve a specific page directly from its file.
15
47
  */
16
48
  async getPage(slug) {
17
49
  try {
18
- const filePath = _path2.default.resolve(
50
+ const filePath = import_path.default.resolve(
19
51
  process.cwd(),
20
52
  this.baseDir,
21
53
  "pages",
22
54
  `${slug}.json`
23
55
  );
24
- if (_fs2.default.existsSync(filePath)) {
25
- const fileContent = _fs2.default.readFileSync(filePath, "utf-8");
56
+ if (import_fs.default.existsSync(filePath)) {
57
+ const fileContent = import_fs.default.readFileSync(filePath, "utf-8");
26
58
  const pageData = JSON.parse(fileContent);
27
59
  return pageData.data !== void 0 ? pageData.data : pageData;
28
60
  }
@@ -41,14 +73,14 @@ var LocalCache = class {
41
73
  */
42
74
  async getCollection(collectionId) {
43
75
  try {
44
- const filePath = _path2.default.resolve(
76
+ const filePath = import_path.default.resolve(
45
77
  process.cwd(),
46
78
  this.baseDir,
47
79
  "collections",
48
80
  `${collectionId}.json`
49
81
  );
50
- if (_fs2.default.existsSync(filePath)) {
51
- const fileContent = _fs2.default.readFileSync(filePath, "utf-8");
82
+ if (import_fs.default.existsSync(filePath)) {
83
+ const fileContent = import_fs.default.readFileSync(filePath, "utf-8");
52
84
  return JSON.parse(fileContent);
53
85
  }
54
86
  } catch (error) {
@@ -66,16 +98,16 @@ var LocalCache = class {
66
98
  */
67
99
  async getGlobals() {
68
100
  try {
69
- const filePath = _path2.default.resolve(
101
+ const filePath = import_path.default.resolve(
70
102
  process.cwd(),
71
103
  this.baseDir,
72
104
  "globals.json"
73
105
  );
74
- if (_fs2.default.existsSync(filePath)) {
75
- const fileContent = _fs2.default.readFileSync(filePath, "utf-8");
106
+ if (import_fs.default.existsSync(filePath)) {
107
+ const fileContent = import_fs.default.readFileSync(filePath, "utf-8");
76
108
  return JSON.parse(fileContent);
77
109
  }
78
- } catch (e) {
110
+ } catch {
79
111
  }
80
112
  return null;
81
113
  }
@@ -87,30 +119,31 @@ var LocalCache = class {
87
119
  const collections = {};
88
120
  let globals = {};
89
121
  try {
90
- const pagesDir = _path2.default.resolve(process.cwd(), this.baseDir, "pages");
91
- if (_fs2.default.existsSync(pagesDir)) {
92
- for (const file of _fs2.default.readdirSync(pagesDir)) {
122
+ const pagesDir = import_path.default.resolve(process.cwd(), this.baseDir, "pages");
123
+ if (import_fs.default.existsSync(pagesDir)) {
124
+ for (const file of import_fs.default.readdirSync(pagesDir)) {
93
125
  if (file.endsWith(".json")) {
94
- const slug = _path2.default.basename(file, ".json");
126
+ const slug = import_path.default.basename(file, ".json");
95
127
  pages[slug] = await this.getPage(slug);
96
128
  }
97
129
  }
98
130
  }
99
- const colsDir = _path2.default.resolve(process.cwd(), this.baseDir, "collections");
100
- if (_fs2.default.existsSync(colsDir)) {
101
- for (const file of _fs2.default.readdirSync(colsDir)) {
131
+ const colsDir = import_path.default.resolve(process.cwd(), this.baseDir, "collections");
132
+ if (import_fs.default.existsSync(colsDir)) {
133
+ for (const file of import_fs.default.readdirSync(colsDir)) {
102
134
  if (file.endsWith(".json")) {
103
- const id = _path2.default.basename(file, ".json");
135
+ const id = import_path.default.basename(file, ".json");
104
136
  collections[id] = await this.getCollection(id) || [];
105
137
  }
106
138
  }
107
139
  }
108
140
  globals = await this.getGlobals() || {};
109
- } catch (e2) {
141
+ } catch {
110
142
  }
111
143
  return { pages, collections, globals };
112
144
  }
113
145
  };
114
-
115
-
116
- exports.LocalCache = LocalCache;
146
+ // Annotate the CommonJS export names for ESM import in node:
147
+ 0 && (module.exports = {
148
+ LocalCache
149
+ });
@@ -1,5 +1,3 @@
1
- "use client";
2
-
3
1
  // src/content/local-cache-server.ts
4
2
  import fs from "fs";
5
3
  import path from "path";