@scalar/import 0.0.4 → 0.0.6

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,21 @@
1
1
  # @scalar/import
2
2
 
3
+ ## 0.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - a40999d: chore: added type safety rule noUncheckedIndexedAccess
8
+ - @scalar/openapi-parser@0.8.9
9
+
10
+ ## 0.0.5
11
+
12
+ ### Patch Changes
13
+
14
+ - 779cf35: feat: import from escaped JS object
15
+ - Updated dependencies [757fade]
16
+ - Updated dependencies [a607115]
17
+ - @scalar/openapi-parser@0.8.9
18
+
3
19
  ## 0.0.4
4
20
 
5
21
  ### Patch Changes
package/dist/resolve.js CHANGED
@@ -157,6 +157,11 @@ function parseHtml(html) {
157
157
  if (linkMatch?.[1]) {
158
158
  return linkMatch[1];
159
159
  }
160
+ // Check for URLs in escaped JS objects
161
+ const escapedJsonMatch = html.match(/\\"spec\\":\{.*?\\"url\\":\\"([^"\\]+)\\"/);
162
+ if (escapedJsonMatch?.[1]) {
163
+ return escapedJsonMatch[1];
164
+ }
160
165
  return undefined;
161
166
  }
162
167
  /**
@@ -206,7 +211,7 @@ function makeRelativeUrlsAbsolute(baseUrl, path) {
206
211
  */
207
212
  function parseEmbeddedOpenApi(html) {
208
213
  const match = html.match(/<script[^>]*data-configuration=['"]([^'"]+)['"][^>]*>(.*?)<\/script>/s);
209
- if (!match)
214
+ if (!match?.[1])
210
215
  return undefined;
211
216
  try {
212
217
  const configString = decodeHtmlEntities(match[1]);
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "postman",
17
17
  "scalar"
18
18
  ],
19
- "version": "0.0.4",
19
+ "version": "0.0.6",
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
@@ -36,11 +36,11 @@
36
36
  "module": "dist/index.js",
37
37
  "dependencies": {
38
38
  "yaml": "^2.4.5",
39
- "@scalar/openapi-parser": "0.8.8"
39
+ "@scalar/openapi-parser": "0.8.9"
40
40
  },
41
41
  "devDependencies": {
42
42
  "vite": "^5.4.9",
43
- "@scalar/build-tooling": "0.1.11"
43
+ "@scalar/build-tooling": "0.1.12"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "scalar-build-rollup",