dsh-plugin-shop 0.6.0-beta.1 → 0.6.0-beta.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.
- package/lib/client.js +47 -4
- package/lib/types/client/locales.d.ts +2 -0
- package/lib/types/client/present.d.ts +14 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4840,6 +4840,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4840
4840
|
* package page.
|
|
4841
4841
|
*/
|
|
4842
4842
|
/**
|
|
4843
|
+
* Whether this entry has a GitHub home the reader could go and inspect.
|
|
4844
|
+
*
|
|
4845
|
+
* True for a github-source entry — a repository IS its identity — and for an
|
|
4846
|
+
* npm entry whose `repository` points at github.com, which is 4892 of the
|
|
4847
|
+
* live catalog's 4915 entries. The mark is therefore ordinary and its
|
|
4848
|
+
* ABSENCE is the signal: a listed package with no public source to read.
|
|
4849
|
+
*
|
|
4850
|
+
* `repository` is untrusted catalog input, so the host is PARSED rather than
|
|
4851
|
+
* pattern-matched — `evil-github.com` and `github.com.evil.test` both end in
|
|
4852
|
+
* the string and neither is GitHub. An unparseable or empty value (two live
|
|
4853
|
+
* entries carry one) is simply not a GitHub home.
|
|
4854
|
+
*/
|
|
4855
|
+
function hasGithubHome(entry) {
|
|
4856
|
+
if (entry.source === "github") return true;
|
|
4857
|
+
if (entry.repository === null) return false;
|
|
4858
|
+
try {
|
|
4859
|
+
const host = new URL(entry.repository).hostname.toLowerCase();
|
|
4860
|
+
return host === "github.com" || host === "www.github.com";
|
|
4861
|
+
} catch {
|
|
4862
|
+
return false;
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
/**
|
|
4843
4866
|
* Who put this entry where it is — the fact a reader wants when two listings
|
|
4844
4867
|
* carry the same text from different hands.
|
|
4845
4868
|
*
|
|
@@ -4966,7 +4989,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4966
4989
|
needsAcknowledgementCode: "需要确认",
|
|
4967
4990
|
gitMissingCode: "缺少 git",
|
|
4968
4991
|
tarballIntegrityCode: "压缩包完整性校验失败",
|
|
4969
|
-
|
|
4992
|
+
npmSource: "npm 包",
|
|
4993
|
+
githubSource: "源码在 GitHub",
|
|
4970
4994
|
installedSection: "已安装",
|
|
4971
4995
|
installedVersion: "已安装 v{version}",
|
|
4972
4996
|
latestVersion: "最新 v{version}",
|
|
@@ -5054,7 +5078,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5054
5078
|
needsAcknowledgementCode: "Acknowledgement required",
|
|
5055
5079
|
gitMissingCode: "git missing",
|
|
5056
5080
|
tarballIntegrityCode: "tarball integrity check failed",
|
|
5057
|
-
|
|
5081
|
+
npmSource: "npm package",
|
|
5082
|
+
githubSource: "source on GitHub",
|
|
5058
5083
|
installedSection: "Installed",
|
|
5059
5084
|
installedVersion: "installed v{version}",
|
|
5060
5085
|
latestVersion: "latest v{version}",
|
|
@@ -5395,8 +5420,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5395
5420
|
className: _dsh_plugin_shop_css_e3675a89_default.categoryBadge,
|
|
5396
5421
|
children: t(categoryKey(entry))
|
|
5397
5422
|
}),
|
|
5398
|
-
entry.source === "
|
|
5423
|
+
entry.source === "npm" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5399
5424
|
className: _dsh_plugin_shop_css_e3675a89_default.sourceBadge,
|
|
5425
|
+
"data-shop-source-npm": true,
|
|
5426
|
+
role: "img",
|
|
5427
|
+
"aria-label": t("npmSource"),
|
|
5428
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
5429
|
+
viewBox: "0 0 16 16",
|
|
5430
|
+
width: "12",
|
|
5431
|
+
height: "12",
|
|
5432
|
+
"aria-hidden": "true",
|
|
5433
|
+
fill: "currentColor",
|
|
5434
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5435
|
+
fillRule: "evenodd",
|
|
5436
|
+
d: "M0 0v16h16V0H0zm13 13h-2V6H8v7H3V3h10v10z"
|
|
5437
|
+
})
|
|
5438
|
+
})
|
|
5439
|
+
}),
|
|
5440
|
+
hasGithubHome(entry) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5441
|
+
className: _dsh_plugin_shop_css_e3675a89_default.sourceBadge,
|
|
5442
|
+
"data-shop-source-github": true,
|
|
5400
5443
|
role: "img",
|
|
5401
5444
|
"aria-label": t("githubSource"),
|
|
5402
5445
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
@@ -5413,7 +5456,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5413
5456
|
"data-card-version": true,
|
|
5414
5457
|
children: ["v", displayVersion(entry)]
|
|
5415
5458
|
}),
|
|
5416
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5459
|
+
entry.tier !== "community" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5417
5460
|
className: _dsh_plugin_shop_css_e3675a89_default.tierBadge,
|
|
5418
5461
|
"data-tier": entry.tier,
|
|
5419
5462
|
children: t(tierKey(entry.tier))
|
|
@@ -58,6 +58,7 @@ export declare const zh: {
|
|
|
58
58
|
needsAcknowledgementCode: string;
|
|
59
59
|
gitMissingCode: string;
|
|
60
60
|
tarballIntegrityCode: string;
|
|
61
|
+
npmSource: string;
|
|
61
62
|
githubSource: string;
|
|
62
63
|
installedSection: string;
|
|
63
64
|
installedVersion: string;
|
|
@@ -148,6 +149,7 @@ export declare const en: {
|
|
|
148
149
|
needsAcknowledgementCode: string;
|
|
149
150
|
gitMissingCode: string;
|
|
150
151
|
tarballIntegrityCode: string;
|
|
152
|
+
npmSource: string;
|
|
151
153
|
githubSource: string;
|
|
152
154
|
installedSection: string;
|
|
153
155
|
installedVersion: string;
|
|
@@ -149,6 +149,20 @@ export declare function categoryLocaleKey(category: Category): ShopLocaleKey;
|
|
|
149
149
|
* A github entry answers null: it is installed from a repo and has no npm
|
|
150
150
|
* package page.
|
|
151
151
|
*/
|
|
152
|
+
/**
|
|
153
|
+
* Whether this entry has a GitHub home the reader could go and inspect.
|
|
154
|
+
*
|
|
155
|
+
* True for a github-source entry — a repository IS its identity — and for an
|
|
156
|
+
* npm entry whose `repository` points at github.com, which is 4892 of the
|
|
157
|
+
* live catalog's 4915 entries. The mark is therefore ordinary and its
|
|
158
|
+
* ABSENCE is the signal: a listed package with no public source to read.
|
|
159
|
+
*
|
|
160
|
+
* `repository` is untrusted catalog input, so the host is PARSED rather than
|
|
161
|
+
* pattern-matched — `evil-github.com` and `github.com.evil.test` both end in
|
|
162
|
+
* the string and neither is GitHub. An unparseable or empty value (two live
|
|
163
|
+
* entries carry one) is simply not a GitHub home.
|
|
164
|
+
*/
|
|
165
|
+
export declare function hasGithubHome(entry: CatalogEntry): boolean;
|
|
152
166
|
/**
|
|
153
167
|
* Who put this entry where it is — the fact a reader wants when two listings
|
|
154
168
|
* carry the same text from different hands.
|
package/package.json
CHANGED