@shadow-shard-tools/docs-core 1.0.0 → 1.0.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.
@@ -0,0 +1,6 @@
1
+ import type { DataProvider } from "../index.js";
2
+ export declare class FileSystemProvider implements DataProvider {
3
+ readJson<T>(absPath: string): Promise<T>;
4
+ fileExists(absPath: string): Promise<boolean>;
5
+ }
6
+ //# sourceMappingURL=fsDataProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsDataProvider.d.ts","sourceRoot":"","sources":["../../src/data/fsDataProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,qBAAa,kBAAmB,YAAW,YAAY;IAC/C,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAKxC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CASpD"}
@@ -0,0 +1,20 @@
1
+ import { readFile, access } from "node:fs/promises";
2
+ import { constants } from "node:fs";
3
+ export class FileSystemProvider {
4
+ async readJson(absPath) {
5
+ const contents = await readFile(absPath, "utf8");
6
+ return JSON.parse(contents);
7
+ }
8
+ async fileExists(absPath) {
9
+ try {
10
+ await access(absPath, constants.F_OK);
11
+ return true;
12
+ }
13
+ catch (err) {
14
+ if (err.code === "ENOENT")
15
+ return false;
16
+ throw err;
17
+ }
18
+ }
19
+ }
20
+ //# sourceMappingURL=fsDataProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsDataProvider.js","sourceRoot":"","sources":["../../src/data/fsDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAC,QAAQ,CAAI,OAAe;QAC/B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAM,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,KAAK,CAAC;YACnE,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import type { DataProvider } from "../index.js";
2
+ export declare class httpDataProvider implements DataProvider {
3
+ readJson<T>(absUrl: string): Promise<T>;
4
+ }
5
+ //# sourceMappingURL=httpDataProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpDataProvider.d.ts","sourceRoot":"","sources":["../../src/data/httpDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,qBAAa,gBAAiB,YAAW,YAAY;IAC7C,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAQ9C"}
@@ -0,0 +1,9 @@
1
+ export class httpDataProvider {
2
+ async readJson(absUrl) {
3
+ const res = await fetch(absUrl);
4
+ if (!res.ok)
5
+ throw new Error(`Failed to fetch ${absUrl}: ${res.status} ${res.statusText}`);
6
+ return res.json();
7
+ }
8
+ }
9
+ //# sourceMappingURL=httpDataProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpDataProvider.js","sourceRoot":"","sources":["../../src/data/httpDataProvider.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAgB;IAC3B,KAAK,CAAC,QAAQ,CAAI,MAAc;QAC9B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,EAAE;YACT,MAAM,IAAI,KAAK,CACb,mBAAmB,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAC7D,CAAC;QACJ,OAAO,GAAG,CAAC,IAAI,EAAgB,CAAC;IAClC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadow-shard-tools/docs-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Shared configs, types, and utilities for SST Docs modules and applications.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -94,16 +94,36 @@
94
94
  },
95
95
  "typesVersions": {
96
96
  "*": {
97
- "configs": ["dist/configs/index.d.ts"],
98
- "configs/*": ["dist/configs/*.d.ts"],
99
- "data": ["dist/data/index.d.ts"],
100
- "data/*": ["dist/data/*.d.ts"],
101
- "themes": ["dist/themes/index.d.ts"],
102
- "themes/*": ["dist/themes/*.d.ts"],
103
- "types": ["dist/types/index.d.ts"],
104
- "types/*": ["dist/types/*.d.ts"],
105
- "utilities": ["dist/utilities/index.d.ts"],
106
- "utilities/*": ["dist/utilities/*.d.ts"]
97
+ "configs": [
98
+ "dist/configs/index.d.ts"
99
+ ],
100
+ "configs/*": [
101
+ "dist/configs/*.d.ts"
102
+ ],
103
+ "data": [
104
+ "dist/data/index.d.ts"
105
+ ],
106
+ "data/*": [
107
+ "dist/data/*.d.ts"
108
+ ],
109
+ "themes": [
110
+ "dist/themes/index.d.ts"
111
+ ],
112
+ "themes/*": [
113
+ "dist/themes/*.d.ts"
114
+ ],
115
+ "types": [
116
+ "dist/types/index.d.ts"
117
+ ],
118
+ "types/*": [
119
+ "dist/types/*.d.ts"
120
+ ],
121
+ "utilities": [
122
+ "dist/utilities/index.d.ts"
123
+ ],
124
+ "utilities/*": [
125
+ "dist/utilities/*.d.ts"
126
+ ]
107
127
  }
108
128
  }
109
129
  }