@genome-spy/core 0.17.0 → 0.18.0
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.
|
@@ -2851,6 +2851,9 @@
|
|
|
2851
2851
|
{
|
|
2852
2852
|
"additionalProperties": false,
|
|
2853
2853
|
"properties": {
|
|
2854
|
+
"$schema": {
|
|
2855
|
+
"type": "string"
|
|
2856
|
+
},
|
|
2854
2857
|
"aggregateSamples": {
|
|
2855
2858
|
"items": {
|
|
2856
2859
|
"anyOf": [
|
|
@@ -3010,6 +3013,9 @@
|
|
|
3010
3013
|
{
|
|
3011
3014
|
"additionalProperties": false,
|
|
3012
3015
|
"properties": {
|
|
3016
|
+
"$schema": {
|
|
3017
|
+
"type": "string"
|
|
3018
|
+
},
|
|
3013
3019
|
"aggregateSamples": {
|
|
3014
3020
|
"items": {
|
|
3015
3021
|
"anyOf": [
|
|
@@ -3172,6 +3178,9 @@
|
|
|
3172
3178
|
{
|
|
3173
3179
|
"additionalProperties": false,
|
|
3174
3180
|
"properties": {
|
|
3181
|
+
"$schema": {
|
|
3182
|
+
"type": "string"
|
|
3183
|
+
},
|
|
3175
3184
|
"baseUrl": {
|
|
3176
3185
|
"type": "string"
|
|
3177
3186
|
},
|
|
@@ -3322,6 +3331,9 @@
|
|
|
3322
3331
|
{
|
|
3323
3332
|
"additionalProperties": false,
|
|
3324
3333
|
"properties": {
|
|
3334
|
+
"$schema": {
|
|
3335
|
+
"type": "string"
|
|
3336
|
+
},
|
|
3325
3337
|
"baseUrl": {
|
|
3326
3338
|
"type": "string"
|
|
3327
3339
|
},
|
|
@@ -3471,6 +3483,9 @@
|
|
|
3471
3483
|
{
|
|
3472
3484
|
"additionalProperties": false,
|
|
3473
3485
|
"properties": {
|
|
3486
|
+
"$schema": {
|
|
3487
|
+
"type": "string"
|
|
3488
|
+
},
|
|
3474
3489
|
"baseUrl": {
|
|
3475
3490
|
"type": "string"
|
|
3476
3491
|
},
|
|
@@ -3620,6 +3635,9 @@
|
|
|
3620
3635
|
{
|
|
3621
3636
|
"additionalProperties": false,
|
|
3622
3637
|
"properties": {
|
|
3638
|
+
"$schema": {
|
|
3639
|
+
"type": "string"
|
|
3640
|
+
},
|
|
3623
3641
|
"baseUrl": {
|
|
3624
3642
|
"type": "string"
|
|
3625
3643
|
},
|
package/package.json
CHANGED
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
},
|
|
8
8
|
"contributors": [],
|
|
9
9
|
"license": "BSD-2-Clause",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.18.0",
|
|
11
11
|
"main": "dist/index.js",
|
|
12
12
|
"module": "src/index.js",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": "./src/index.js",
|
|
15
|
-
"./*": "./src/*"
|
|
15
|
+
"./*": "./src/*",
|
|
16
|
+
"./schema.json": "./dist/schema.json"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"dist/",
|
|
@@ -20,16 +21,16 @@
|
|
|
20
21
|
],
|
|
21
22
|
"repository": {
|
|
22
23
|
"type": "git",
|
|
23
|
-
"url": "github:
|
|
24
|
+
"url": "github:genome-spy/genome-spy",
|
|
24
25
|
"directory": "packages/core"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
28
|
"dev": "node dev-server.js",
|
|
28
|
-
"build": "vite build",
|
|
29
|
-
"prepublishOnly": "npm run build
|
|
29
|
+
"build": "vite build && npm run build:schema",
|
|
30
|
+
"prepublishOnly": "npm run build",
|
|
30
31
|
"test:tsc": "tsc -p tsconfig.json",
|
|
31
32
|
"checkSpec": "tsc --allowJs --checkJs --strict --noEmit --moduleResolution node --target es6 src/spec/root.d.ts",
|
|
32
|
-
"build:schema": "mkdir -p dist && ts-json-schema-generator --path 'src/spec/*.ts' --type RootSpec > dist/
|
|
33
|
+
"build:schema": "mkdir -p dist && ts-json-schema-generator --path 'src/spec/*.ts' --type RootSpec > dist/schema.json"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@types/d3-array": "^3.0.2",
|
|
@@ -51,5 +52,5 @@
|
|
|
51
52
|
"vega-scale": "^7.1.1",
|
|
52
53
|
"vega-util": "^1.16.0"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "ae445fc90ed7640ad9c3b39e81560d81126ebbeb"
|
|
55
56
|
}
|
package/src/spec/root.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} url
|
|
3
|
+
* @param {string} baseUrl
|
|
4
|
+
*/
|
|
5
|
+
export default function addBaseUrl(url, baseUrl) {
|
|
6
|
+
// Regex copied from vega-loader
|
|
7
|
+
if (!baseUrl || /^(data:|([A-Za-z]+:)?\/\/)/.test(url)) {
|
|
8
|
+
return url;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!url.startsWith("/")) {
|
|
12
|
+
if (!baseUrl.endsWith("/")) {
|
|
13
|
+
baseUrl += "/";
|
|
14
|
+
}
|
|
15
|
+
return baseUrl + url;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return url;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import addBaseUrl from "./addBaseUrl";
|
|
2
|
+
|
|
3
|
+
test("addBaseUrl adds baseUrl when needed", () => {
|
|
4
|
+
expect(addBaseUrl("foo.html", "https://site.com/")).toEqual(
|
|
5
|
+
"https://site.com/foo.html"
|
|
6
|
+
);
|
|
7
|
+
expect(addBaseUrl("foo.html", "https://site.com")).toEqual(
|
|
8
|
+
"https://site.com/foo.html"
|
|
9
|
+
);
|
|
10
|
+
expect(addBaseUrl("bar/foo.html", "https://site.com/")).toEqual(
|
|
11
|
+
"https://site.com/bar/foo.html"
|
|
12
|
+
);
|
|
13
|
+
expect(addBaseUrl("../foo.html", "https://site.com/bar/")).toEqual(
|
|
14
|
+
"https://site.com/bar/../foo.html"
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("addBaseUrl doesn't add baseUrl when not needed", () => {
|
|
19
|
+
expect(addBaseUrl("/foo.html", "https://site.com/")).toEqual("/foo.html");
|
|
20
|
+
expect(addBaseUrl("foo.html", undefined)).toEqual("foo.html");
|
|
21
|
+
});
|