@mearl/preset 3.0.0-beta.0 → 3.0.0-beta.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/manifest.js +12 -1
- package/package.json +6 -1
package/dist/manifest.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateInstallationOrigin } from './installation.js';
|
|
1
2
|
import { valid, validRange } from 'semver';
|
|
2
3
|
export class PresetError extends Error {
|
|
3
4
|
code;
|
|
@@ -137,7 +138,17 @@ export function validatePreset(value) {
|
|
|
137
138
|
fields(value.permissions, 'permissions', ['origins']);
|
|
138
139
|
if ('origins' in value.permissions)
|
|
139
140
|
stringArray(value.permissions.origins, 'permissions.origins');
|
|
140
|
-
|
|
141
|
+
const origins = value.permissions.origins ?? [];
|
|
142
|
+
if (origins.length > 64)
|
|
143
|
+
invalid('permissions.origins', 'exceeds 64 scopes');
|
|
144
|
+
result.permissions = { origins: [...new Set(origins.map((origin, index) => {
|
|
145
|
+
try {
|
|
146
|
+
return validateInstallationOrigin(origin);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return invalid(`permissions.origins[${index}]`, 'expected an explicit HTTP host scope');
|
|
150
|
+
}
|
|
151
|
+
}))] };
|
|
141
152
|
}
|
|
142
153
|
if (JSON.stringify(result).length > 262_144)
|
|
143
154
|
invalid('preset', 'manifest exceeds 256 Ki UTF-16 code units');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/preset",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"description": "Browser-compatible preset validation, inheritance and capability resolution for Mearl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/semver": "^7.7.1"
|
|
32
32
|
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/F-loat/mearl.git",
|
|
36
|
+
"directory": "packages/preset"
|
|
37
|
+
},
|
|
33
38
|
"scripts": {
|
|
34
39
|
"build": "rm -rf dist/ && tsc",
|
|
35
40
|
"typecheck": "tsc --noEmit",
|