@scalar/api-client 0.12.12 → 0.12.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 0.12.13
4
+
5
+ ### Patch Changes
6
+
7
+ - c5e8b13: feat: hide secret credentials
8
+ - Updated dependencies [c5e8b13]
9
+ - @scalar/components@0.4.1
10
+
3
11
  ## 0.12.12
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1041,6 +1041,19 @@ pre[class*="language-"].line-numbers > code {
1041
1041
  color: var(--theme-color-green, var(--default-theme-color-green));
1042
1042
  }
1043
1043
 
1044
+ /** Hide credentials */
1045
+ .credentials {
1046
+ font-size: 0;
1047
+ color: transparent;
1048
+ }
1049
+
1050
+ /** Show a few dots instead */
1051
+ .credentials::after {
1052
+ content: '·····';
1053
+ font-size: var(--theme-small, var(--default-theme-small));
1054
+ color: var(--theme-color-3, var(--default-theme-color-3));
1055
+ }
1056
+
1044
1057
  .scalar-modal-layout[data-v-53cbffc0] {
1045
1058
  animation: modal-fade-53cbffc0 0.2s forwards;
1046
1059
  }
@@ -32203,11 +32216,42 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
32203
32216
  props: {
32204
32217
  content: {},
32205
32218
  lang: { default: "js" },
32206
- lineNumbers: { type: Boolean, default: false }
32219
+ lineNumbers: { type: Boolean, default: false },
32220
+ hideCredentials: {}
32207
32221
  },
32208
32222
  setup(__props) {
32209
32223
  const props = __props;
32210
32224
  const { plugins, highlightElement } = prismjs;
32225
+ if (props.hideCredentials) {
32226
+ prismjs.hooks.add("wrap", function(env) {
32227
+ if (!props.hideCredentials) {
32228
+ return;
32229
+ }
32230
+ let showsCredentials = false;
32231
+ if (typeof props.hideCredentials === "string") {
32232
+ if (env.content.includes(props.hideCredentials)) {
32233
+ showsCredentials = true;
32234
+ }
32235
+ } else if (Array.isArray(props.hideCredentials)) {
32236
+ showsCredentials = props.hideCredentials.some(
32237
+ (token) => env.content.includes(token)
32238
+ );
32239
+ }
32240
+ if (showsCredentials) {
32241
+ env.content = env.content.replace(
32242
+ /<span class="credentials">.*?<\/span>/g,
32243
+ (match) => match.replace(/<span class="credentials">|<\/span>/g, "")
32244
+ );
32245
+ env.content = env.content.replace(
32246
+ new RegExp(
32247
+ typeof props.hideCredentials === "string" ? props.hideCredentials : props.hideCredentials.join("|"),
32248
+ "g"
32249
+ ),
32250
+ (match) => `<span class="credentials">${match}</span>`
32251
+ );
32252
+ }
32253
+ });
32254
+ }
32211
32255
  const el = ref(null);
32212
32256
  const language2 = computed(() => {
32213
32257
  return props.lang === "node" ? "js" : props.lang;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "rest",
14
14
  "testing"
15
15
  ],
16
- "version": "0.12.12",
16
+ "version": "0.12.13",
17
17
  "engines": {
18
18
  "node": ">=18"
19
19
  },
@@ -42,10 +42,10 @@
42
42
  "pretty-bytes": "^6.1.1",
43
43
  "pretty-ms": "^8.0.0",
44
44
  "vue": "^3.3.0",
45
- "@scalar/components": "0.4.0",
46
45
  "@scalar/themes": "0.5.10",
47
- "@scalar/use-modal": "0.2.8",
48
- "@scalar/use-codemirror": "0.8.8"
46
+ "@scalar/components": "0.4.1",
47
+ "@scalar/use-codemirror": "0.8.8",
48
+ "@scalar/use-modal": "0.2.8"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/content-type": "^1.1.6",