@rootsmithio/client 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +57 -2
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15344 -0
- package/dist/page.d.ts +14 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/url.d.ts +3 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +31 -0
- package/package.json +51 -3
package/dist/page.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PublishedPage {
|
|
2
|
+
id: string;
|
|
3
|
+
siteId: string;
|
|
4
|
+
pageTypeId: string;
|
|
5
|
+
revision: number;
|
|
6
|
+
title: string;
|
|
7
|
+
path: string;
|
|
8
|
+
description: string;
|
|
9
|
+
markdown: string;
|
|
10
|
+
url: string;
|
|
11
|
+
publishedAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
package/dist/url.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,UAY7D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,UAMrC"}
|
package/dist/url.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/url.ts
|
|
2
|
+
var safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
|
|
3
|
+
function allowedUrl(value) {
|
|
4
|
+
const colon = value.indexOf(":");
|
|
5
|
+
const end = [value.indexOf("/"), value.indexOf("?"), value.indexOf("#")];
|
|
6
|
+
return colon === -1 || end.some((index) => index !== -1 && colon > index) || safeProtocol.test(value.slice(0, colon));
|
|
7
|
+
}
|
|
8
|
+
function safeContentUrl(value, baseUrl) {
|
|
9
|
+
const safe = allowedUrl(value) ? value : "";
|
|
10
|
+
if (!safe || safe.startsWith("//") || safe.includes("\\")) return "";
|
|
11
|
+
if (safe.startsWith("#")) return safe;
|
|
12
|
+
if (baseUrl) {
|
|
13
|
+
try {
|
|
14
|
+
return new URL(safe, baseUrl).href;
|
|
15
|
+
} catch {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return safe;
|
|
20
|
+
}
|
|
21
|
+
function originOf(value) {
|
|
22
|
+
try {
|
|
23
|
+
return new URL(value).origin;
|
|
24
|
+
} catch {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
originOf,
|
|
30
|
+
safeContentUrl
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rootsmithio/client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Read and render published RootSmith pages in any JavaScript framework",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Sidewave-Digital-Inc/rootsmith.git",
|
|
9
|
+
"directory": "packages/client"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./url": {
|
|
25
|
+
"types": "./dist/url.d.ts",
|
|
26
|
+
"default": "./dist/url.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"hast-util-to-html": "^9.0.5",
|
|
31
|
+
"remark-gfm": "^4.0.1",
|
|
32
|
+
"remark-parse": "^11.0.0",
|
|
33
|
+
"remark-rehype": "^11.1.2",
|
|
34
|
+
"unified": "^11.0.5"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/hast": "^3.0.4",
|
|
38
|
+
"@types/node": "^24",
|
|
39
|
+
"eslint": "^9",
|
|
40
|
+
"esbuild": "^0.28.2",
|
|
41
|
+
"typescript": "^5",
|
|
42
|
+
"vitest": "4.1.11",
|
|
43
|
+
"@workspace/eslint-config": "0.0.0",
|
|
44
|
+
"@workspace/contracts": "0.0.1",
|
|
45
|
+
"@workspace/typescript-config": "0.0.0"
|
|
46
|
+
},
|
|
47
|
+
"sideEffects": false,
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc --emitDeclarationOnly && esbuild src/index.ts src/url.ts --bundle --platform=node --format=esm --external:unified --external:remark-parse --external:remark-gfm --external:remark-rehype --external:hast-util-to-html --outdir=dist",
|
|
50
|
+
"lint": "eslint src test",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"test": "vitest run"
|
|
53
|
+
}
|
|
6
54
|
}
|