@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.
- package/dist/content/local-cache-client.cjs +27 -4
- package/dist/content/local-cache-client.js +0 -2
- package/dist/content/local-cache-server.cjs +59 -26
- package/dist/content/local-cache-server.js +0 -2
- package/dist/index.cjs +2509 -33
- package/dist/index.d.cts +321 -4
- package/dist/index.d.ts +321 -4
- package/dist/index.js +2457 -28
- package/dist/local-cache-client-I6UYVJJV.js +59 -0
- package/dist/local-cache-client-IGAL7SZ6.cjs +59 -0
- package/dist/local-cache-server-6DXQJFCQ.cjs +114 -0
- package/dist/local-cache-server-DBJWR7HD.js +114 -0
- package/dist/react.cjs +2610 -3
- package/dist/react.d.cts +349 -3
- package/dist/react.d.ts +349 -3
- package/dist/react.js +2615 -8
- package/package.json +1 -1
- package/dist/chunk-FMMFQP5O.cjs +0 -2643
- package/dist/chunk-G4SHBWAQ.js +0 -2643
- package/dist/react-C795ypnM.d.cts +0 -386
- package/dist/react-C795ypnM.d.ts +0 -386
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
LocalCache
|
|
84
|
+
});
|
|
@@ -1,28 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
|
5
|
-
|
|
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
|
|
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 =
|
|
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 (
|
|
25
|
-
const fileContent =
|
|
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 =
|
|
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 (
|
|
51
|
-
const fileContent =
|
|
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 =
|
|
101
|
+
const filePath = import_path.default.resolve(
|
|
70
102
|
process.cwd(),
|
|
71
103
|
this.baseDir,
|
|
72
104
|
"globals.json"
|
|
73
105
|
);
|
|
74
|
-
if (
|
|
75
|
-
const fileContent =
|
|
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
|
|
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 =
|
|
91
|
-
if (
|
|
92
|
-
for (const file of
|
|
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 =
|
|
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 =
|
|
100
|
-
if (
|
|
101
|
-
for (const file of
|
|
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 =
|
|
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
|
|
141
|
+
} catch {
|
|
110
142
|
}
|
|
111
143
|
return { pages, collections, globals };
|
|
112
144
|
}
|
|
113
145
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
LocalCache
|
|
149
|
+
});
|