@scalar/core 0.3.5 → 0.3.8

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,28 @@
1
1
  # @scalar/core
2
2
 
3
+ ## 0.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c10e191]
8
+ - @scalar/types@0.2.8
9
+
10
+ ## 0.3.7
11
+
12
+ ### Patch Changes
13
+
14
+ - 66347d4: fix: handle config properties that accept both string and function types
15
+ - Updated dependencies [ad2e3e6]
16
+ - @scalar/types@0.2.7
17
+
18
+ ## 0.3.6
19
+
20
+ ### Patch Changes
21
+
22
+ - 2d7f995: refactor: use more common straight apostrophe ' instead of the real apostrophe ’
23
+ - Updated dependencies [2d7f995]
24
+ - @scalar/types@0.2.6
25
+
3
26
  ## 0.3.5
4
27
 
5
28
  ### Patch Changes
package/README.md CHANGED
@@ -26,7 +26,7 @@ const html = getHtmlDocument({
26
26
 
27
27
  ## Community
28
28
 
29
- We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/scalar>
29
+ We are API nerds. You too? Let's chat on Discord: <https://discord.gg/scalar>
30
30
 
31
31
  ## License
32
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"html-rendering.d.ts","sourceRoot":"","sources":["../../../src/libs/html-rendering/html-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAGxG,YAAY,EAAE,0BAA0B,EAAE,CAAA;AA+C1C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,uBAAwB,OAAO,CAAC,0BAA0B,CAAC,iCAwBtF,CAAA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,UAwD5F;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,uBACP,OAAO,CAAC,yBAAyB,CAAC,KACrD,OAAO,CAAC,yBAAyB,CAkBnC,CAAA"}
1
+ {"version":3,"file":"html-rendering.d.ts","sourceRoot":"","sources":["../../../src/libs/html-rendering/html-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAGxG,YAAY,EAAE,0BAA0B,EAAE,CAAA;AA+C1C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,uBAAwB,OAAO,CAAC,0BAA0B,CAAC,iCAwBtF,CAAA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,UA2C5F;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,uBACP,OAAO,CAAC,yBAAyB,CAAC,KACrD,OAAO,CAAC,yBAAyB,CAkBnC,CAAA"}
@@ -69,28 +69,28 @@ const getHtmlDocument = (givenConfiguration, customTheme = '') => {
69
69
  * The script tags to load the @scalar/api-reference package from the CDN.
70
70
  */
71
71
  function getScriptTags(configuration, cdn) {
72
- // Extract function properties before stringifying
73
- const { tagsSorter, operationsSorter, generateHeadingSlug, generateModelSlug, generateTagSlug, generateOperationSlug, generateWebhookSlug, onLoaded, redirect, onSpecUpdate, onServerChange, ...restConfig } = configuration;
74
- // Create the function strings if they exist
72
+ const restConfig = { ...configuration };
75
73
  const functionProps = [];
76
- const functionProperties = [
77
- { name: 'tagsSorter', value: tagsSorter },
78
- { name: 'operationsSorter', value: operationsSorter },
79
- { name: 'generateHeadingSlug', value: generateHeadingSlug },
80
- { name: 'generateModelSlug', value: generateModelSlug },
81
- { name: 'generateTagSlug', value: generateTagSlug },
82
- { name: 'generateOperationSlug', value: generateOperationSlug },
83
- { name: 'generateWebhookSlug', value: generateWebhookSlug },
84
- { name: 'onLoaded', value: onLoaded },
85
- { name: 'redirect', value: redirect },
86
- { name: 'onSpecUpdate', value: onSpecUpdate },
87
- { name: 'onServerChange', value: onServerChange },
74
+ const functionKeys = [
75
+ 'tagsSorter',
76
+ 'operationsSorter',
77
+ 'generateHeadingSlug',
78
+ 'generateModelSlug',
79
+ 'generateTagSlug',
80
+ 'generateOperationSlug',
81
+ 'generateWebhookSlug',
82
+ 'onLoaded',
83
+ 'redirect',
84
+ 'onSpecUpdate',
85
+ 'onServerChange',
88
86
  ];
89
- functionProperties.forEach(({ name, value }) => {
87
+ for (const key of functionKeys) {
88
+ const value = configuration[key];
90
89
  if (value && typeof value === 'function') {
91
- functionProps.push(`"${name}": ${value.toString()}`);
90
+ functionProps.push(`"${key}": ${value.toString()}`);
91
+ delete restConfig[key];
92
92
  }
93
- });
93
+ }
94
94
  // Stringify the rest of the configuration
95
95
  const configString = JSON.stringify(restConfig, null, 2)
96
96
  .split('\n')
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/core"
12
12
  },
13
13
  "keywords": [],
14
- "version": "0.3.5",
14
+ "version": "0.3.8",
15
15
  "engines": {
16
16
  "node": ">=20"
17
17
  },
@@ -35,11 +35,11 @@
35
35
  ],
36
36
  "module": "dist/index.js",
37
37
  "dependencies": {
38
- "@scalar/types": "0.2.5"
38
+ "@scalar/types": "0.2.8"
39
39
  },
40
40
  "devDependencies": {
41
41
  "vite": "5.4.19",
42
- "@scalar/build-tooling": "0.2.3"
42
+ "@scalar/build-tooling": "0.2.4"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "scalar-build-rollup",