@protobase/schema 0.46.15 → 0.47.1
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/dist/plugin-version.d.ts +1 -1
- package/dist/plugin-version.js +12 -28
- package/dist/png-icons.d.ts +25 -0
- package/dist/png-icons.js +26 -0
- package/package.json +7 -2
package/dist/plugin-version.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/plugin-version.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* Whether `version` is in `range`: comparators such as `>=0.12.0 <1.0.0`, separated by spaces, all of which must hold.
|
|
4
|
-
* Undefined when the range is not one of those, or the version is no
|
|
4
|
+
* Undefined when the range is not one of those, or the version is no semver version.
|
|
5
5
|
*/
|
|
6
6
|
export declare const inRange: (version: string, range: string) => boolean | undefined;
|
|
7
7
|
/** What a plugin's plugin.json says it is built for: a plugin API, and the Protobase versions it runs on. */
|
package/dist/plugin-version.js
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
+
import semver from "semver";
|
|
1
2
|
//#region src/plugin-version.ts
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
const compare = (a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
12
|
-
const comparatorPattern = /^(>=|<=|>|<|=)?(.+)$/;
|
|
13
|
-
const holds = {
|
|
14
|
-
">=": (order) => order >= 0,
|
|
15
|
-
"<=": (order) => order <= 0,
|
|
16
|
-
">": (order) => order > 0,
|
|
17
|
-
"<": (order) => order < 0,
|
|
18
|
-
"=": (order) => order === 0
|
|
3
|
+
const isComparator = (text) => {
|
|
4
|
+
try {
|
|
5
|
+
new semver.Comparator(text);
|
|
6
|
+
return true;
|
|
7
|
+
} catch (error) {
|
|
8
|
+
if (error instanceof TypeError) return false;
|
|
9
|
+
throw error;
|
|
10
|
+
}
|
|
19
11
|
};
|
|
20
12
|
/**
|
|
21
13
|
* Whether `version` is in `range`: comparators such as `>=0.12.0 <1.0.0`, separated by spaces, all of which must hold.
|
|
22
|
-
* Undefined when the range is not one of those, or the version is no
|
|
14
|
+
* Undefined when the range is not one of those, or the version is no semver version.
|
|
23
15
|
*/
|
|
24
16
|
const inRange = (version, range) => {
|
|
25
|
-
const own = parseVersion(version);
|
|
26
17
|
const comparators = range.trim().split(/\s+/);
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
for (const comparator of comparators) {
|
|
30
|
-
const [, operator = "=", text = ""] = comparatorPattern.exec(comparator) ?? [];
|
|
31
|
-
const bound = parseVersion(text);
|
|
32
|
-
if (!bound) return void 0;
|
|
33
|
-
result &&= holds[operator](compare(own, bound));
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
18
|
+
if (semver.valid(version) === null || range.trim() === "" || !comparators.every(isComparator)) return void 0;
|
|
19
|
+
return semver.satisfies(version, range);
|
|
36
20
|
};
|
|
37
21
|
/**
|
|
38
22
|
* Why an app does not load a plugin built for `requirement`, or undefined when it does: the plugin API must be the
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/png-icons.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The PNG icons a project may put beside its `protobase.favicon.svg`, for platforms that take no SVG, each square at
|
|
4
|
+
* `size` pixels and answered on the app's own origin at `/<file>`: Android's 192 and 512 pixel icons, a 512 pixel
|
|
5
|
+
* maskable one whose mark keeps to the middle 80%, and the 180 pixel Apple touch icon an iPhone home screen shows.
|
|
6
|
+
*/
|
|
7
|
+
export declare const pngIcons: {
|
|
8
|
+
readonly icon192: {
|
|
9
|
+
readonly file: "protobase.icon-192.png";
|
|
10
|
+
readonly size: 192;
|
|
11
|
+
};
|
|
12
|
+
readonly icon512: {
|
|
13
|
+
readonly file: "protobase.icon-512.png";
|
|
14
|
+
readonly size: 512;
|
|
15
|
+
};
|
|
16
|
+
readonly maskable: {
|
|
17
|
+
readonly file: "protobase.icon-maskable.png";
|
|
18
|
+
readonly size: 512;
|
|
19
|
+
};
|
|
20
|
+
readonly appleTouch: {
|
|
21
|
+
readonly file: "protobase.apple-touch-icon.png";
|
|
22
|
+
readonly size: 180;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/png-icons.ts
|
|
2
|
+
/**
|
|
3
|
+
* The PNG icons a project may put beside its `protobase.favicon.svg`, for platforms that take no SVG, each square at
|
|
4
|
+
* `size` pixels and answered on the app's own origin at `/<file>`: Android's 192 and 512 pixel icons, a 512 pixel
|
|
5
|
+
* maskable one whose mark keeps to the middle 80%, and the 180 pixel Apple touch icon an iPhone home screen shows.
|
|
6
|
+
*/
|
|
7
|
+
const pngIcons = {
|
|
8
|
+
icon192: {
|
|
9
|
+
file: "protobase.icon-192.png",
|
|
10
|
+
size: 192
|
|
11
|
+
},
|
|
12
|
+
icon512: {
|
|
13
|
+
file: "protobase.icon-512.png",
|
|
14
|
+
size: 512
|
|
15
|
+
},
|
|
16
|
+
maskable: {
|
|
17
|
+
file: "protobase.icon-maskable.png",
|
|
18
|
+
size: 512
|
|
19
|
+
},
|
|
20
|
+
appleTouch: {
|
|
21
|
+
file: "protobase.apple-touch-icon.png",
|
|
22
|
+
size: 180
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { pngIcons };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.1",
|
|
4
4
|
"description": "Resource, field, view and access definitions for Protobase configs.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": "./dist/index.js",
|
|
19
|
-
"./internal": "./dist/internal.js"
|
|
19
|
+
"./internal": "./dist/internal.js",
|
|
20
|
+
"./png-icons": "./dist/png-icons.js"
|
|
20
21
|
},
|
|
21
22
|
"types": "./dist/index.d.ts",
|
|
22
23
|
"files": [
|
|
@@ -31,6 +32,10 @@
|
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"aip-parsers": "^1.0.0",
|
|
35
|
+
"semver": "^7.8.5",
|
|
34
36
|
"zod": "^4.6.5"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/semver": "^7.8.0"
|
|
35
40
|
}
|
|
36
41
|
}
|