@ecency/render-helper 2.5.25 → 2.5.27
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/README.md +4 -4
- package/dist/THIRD-PARTY-NOTICES.md +85 -0
- package/dist/browser/index.d.ts +16 -0
- package/dist/browser/index.js +11 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +8235 -188
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +8233 -186
- package/dist/node/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,11 +15,11 @@ Built and maintained by [Ecency](https://ecency.com), an open-source social plat
|
|
|
15
15
|
|
|
16
16
|
### From Monorepo Root
|
|
17
17
|
- `pnpm render-helper` - Build render-helper package
|
|
18
|
-
- `pnpm build:packages` - Build all packages (sdk, wallets,
|
|
18
|
+
- `pnpm build:packages` - Build all packages (sdk, wallets, render-helper, ui)
|
|
19
19
|
- `pnpm publish:render-helper` - Manually publish to npm
|
|
20
20
|
|
|
21
21
|
### CI/CD
|
|
22
|
-
- Part of vision-
|
|
22
|
+
- Part of vision-web monorepo with centralized GitHub Actions (`.github/workflows/packages.yml`)
|
|
23
23
|
- Automatically detects changes to `packages/render-helper/**` using git diff
|
|
24
24
|
- On push to `develop` branch, builds and publishes to npm
|
|
25
25
|
- Uses OIDC (OpenID Connect) for secure npm authentication
|
|
@@ -128,7 +128,7 @@ src/
|
|
|
128
128
|
|
|
129
129
|
## Build System
|
|
130
130
|
|
|
131
|
-
- Uses **tsup** for bundling (shared with other vision-
|
|
131
|
+
- Uses **tsup** for bundling (shared with other vision-web packages)
|
|
132
132
|
- TypeScript 5.6+ with strict mode enabled
|
|
133
133
|
- Outputs three bundles:
|
|
134
134
|
- `dist/browser/index.js` - Browser ESM with TypeScript declarations
|
|
@@ -173,6 +173,6 @@ const summary = postBodySummary(entry, 200, 'react-native')
|
|
|
173
173
|
- When adding embed support for new platforms, implement server-side rendering only
|
|
174
174
|
- All external content must go through sanitization
|
|
175
175
|
- Version bumps required for auto-publish via CI
|
|
176
|
-
- Part of vision-
|
|
176
|
+
- Part of vision-web monorepo - changes require updating across dependent packages
|
|
177
177
|
- The `@ecency/renderer` package uses this as a workspace dependency
|
|
178
178
|
- Exports are optimized for tree-shaking with proper ESM structure
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@ecency/render-helper` bundles the following packages into its published build output.
|
|
4
|
+
Their licences and copyright notices are reproduced here in full, as those licences require.
|
|
5
|
+
|
|
6
|
+
This file is generated during the build from the bundler's own metafile, so it lists what was
|
|
7
|
+
actually inlined. Do not edit it by hand.
|
|
8
|
+
|
|
9
|
+
## autolinker 3.16.2
|
|
10
|
+
|
|
11
|
+
License: MIT
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
The MIT License (MIT)
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2014 Gregory Jacobs (http://greg-jacobs.com)
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
19
|
+
a copy of this software and associated documentation files (the
|
|
20
|
+
"Software"), to deal in the Software without restriction, including
|
|
21
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
22
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
23
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
24
|
+
the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be
|
|
27
|
+
included in all copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
30
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
31
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
32
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
33
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
34
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
35
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## remarkable 2.0.1
|
|
39
|
+
|
|
40
|
+
License: MIT
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
The MIT License (MIT)
|
|
44
|
+
|
|
45
|
+
Copyright (c) 2014-2016, Jon Schlinkert
|
|
46
|
+
Copyright (c) 2014 Jon Schlinkert, Vitaly Puzrin.
|
|
47
|
+
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
49
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
50
|
+
in the Software without restriction, including without limitation the rights
|
|
51
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
52
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
53
|
+
furnished to do so, subject to the following conditions:
|
|
54
|
+
|
|
55
|
+
The above copyright notice and this permission notice shall be included in
|
|
56
|
+
all copies or substantial portions of the Software.
|
|
57
|
+
|
|
58
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
59
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
60
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
61
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
62
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
63
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
64
|
+
THE SOFTWARE.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## tslib 2.8.1
|
|
68
|
+
|
|
69
|
+
License: 0BSD
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Copyright (c) Microsoft Corporation.
|
|
73
|
+
|
|
74
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
75
|
+
purpose with or without fee is hereby granted.
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
78
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
79
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
80
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
81
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
82
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
83
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
84
|
+
```
|
|
85
|
+
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -22,6 +22,22 @@ interface RenderOptions {
|
|
|
22
22
|
* existing chip styling still applies.
|
|
23
23
|
*/
|
|
24
24
|
inertAuthorAndTagChips?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Absolute origin for links a consumer has no route to serve itself, e.g.
|
|
27
|
+
* `https://ecency.com`. Only affects the non-app render path.
|
|
28
|
+
*
|
|
29
|
+
* This is for PROFILE SECTION links, `/@user/wallet`, `/@user/followers` and
|
|
30
|
+
* the rest of SECTION_LIST. They are emitted as ordinary links, so a
|
|
31
|
+
* consumer whose only matching route is `/:author/:permlink` routes them as a
|
|
32
|
+
* post and tries to load one whose permlink is `wallet`. That is not a dead
|
|
33
|
+
* route, so no route guard catches it, and it is not a chip, so
|
|
34
|
+
* `inertAuthorAndTagChips` does not either.
|
|
35
|
+
*
|
|
36
|
+
* Post links themselves are deliberately NOT rewritten: `/@author/permlink`
|
|
37
|
+
* is real content the consumer can resolve from the chain, and keeping it
|
|
38
|
+
* internal is the point of a self-hosted blog.
|
|
39
|
+
*/
|
|
40
|
+
externalProfileBase?: string;
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
/**
|
package/dist/browser/index.js
CHANGED
|
@@ -1069,9 +1069,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1069
1069
|
if (el.textContent === href) {
|
|
1070
1070
|
el.textContent = `@${author}/${section}`;
|
|
1071
1071
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
el.setAttribute("href",
|
|
1072
|
+
const external1 = renderOptions?.externalProfileBase;
|
|
1073
|
+
if (forApp || external1) {
|
|
1074
|
+
el.setAttribute("href", `${external1 ?? "https://ecency.com"}/@${author}/${section}`);
|
|
1075
1075
|
} else {
|
|
1076
1076
|
const h = `/@${author}/${section}`;
|
|
1077
1077
|
el.setAttribute("href", h);
|
|
@@ -1139,9 +1139,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1139
1139
|
if (el.textContent === href) {
|
|
1140
1140
|
el.textContent = `@${author}/${section}`;
|
|
1141
1141
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
el.setAttribute("href",
|
|
1142
|
+
const external2 = renderOptions?.externalProfileBase;
|
|
1143
|
+
if (forApp || external2) {
|
|
1144
|
+
el.setAttribute("href", `${external2 ?? "https://ecency.com"}/@${author}/${section}`);
|
|
1145
1145
|
} else {
|
|
1146
1146
|
const h = `/@${author}/${section}`;
|
|
1147
1147
|
el.setAttribute("href", h);
|
|
@@ -1799,7 +1799,8 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1799
1799
|
const permlink = sanitizePermlink(p3);
|
|
1800
1800
|
if (!isValidPermlink(permlink)) return match;
|
|
1801
1801
|
if (SECTION_LIST.includes(permlink)) {
|
|
1802
|
-
const
|
|
1802
|
+
const external = renderOptions?.externalProfileBase;
|
|
1803
|
+
const attrs = forApp || external ? `href="${external ?? "https://ecency.com"}/@${authorLower}/${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
1803
1804
|
return `${preceding}<a class="markdown-profile-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1804
1805
|
} else {
|
|
1805
1806
|
const attrs = forApp ? `data-author="${authorLower}" data-tag="${tag}" data-permlink="${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
@@ -1814,7 +1815,8 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1814
1815
|
const permlink = sanitizePermlink(p3);
|
|
1815
1816
|
if (!isValidPermlink(permlink)) return match;
|
|
1816
1817
|
if (SECTION_LIST.includes(permlink)) {
|
|
1817
|
-
const
|
|
1818
|
+
const external = renderOptions?.externalProfileBase;
|
|
1819
|
+
const attrs = forApp || external ? `href="${external ?? "https://ecency.com"}/@${uu}/${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
1818
1820
|
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${permlink}</a>`;
|
|
1819
1821
|
} else {
|
|
1820
1822
|
const attrs = forApp ? `data-author="${uu}" data-tag="post" data-permlink="${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
@@ -2161,7 +2163,7 @@ function markdown2Html(obj, forApp = true, _webp = false, parentDomain = "ecency
|
|
|
2161
2163
|
logIfSlow(performance.now() - t02, `body_len=${obj.length}`);
|
|
2162
2164
|
return res2;
|
|
2163
2165
|
}
|
|
2164
|
-
const key = `${makeEntryCacheKey(obj)}-md-${forApp ? "app" : "site"}-${parentDomain}${seoContext ? `-seo${seoContext.authorReputation ?? ""}-${seoContext.postPayout ?? ""}` : ""}${renderOptions?.embedVideosDirectly ? "-embed" : ""}${renderOptions?.inertAuthorAndTagChips ? "-inert" : ""}`;
|
|
2166
|
+
const key = `${makeEntryCacheKey(obj)}-md-${forApp ? "app" : "site"}-${parentDomain}${seoContext ? `-seo${seoContext.authorReputation ?? ""}-${seoContext.postPayout ?? ""}` : ""}${renderOptions?.embedVideosDirectly ? "-embed" : ""}${renderOptions?.inertAuthorAndTagChips ? "-inert" : ""}${renderOptions?.externalProfileBase ? "-ext" + renderOptions.externalProfileBase : ""}`;
|
|
2165
2167
|
const item = cacheGet(key);
|
|
2166
2168
|
if (item) {
|
|
2167
2169
|
return item;
|