@mapbox/mapbox-gl-style-spec 14.24.0 → 14.25.0-rc.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/bin/gl-style-composite.js +9 -4
- package/bin/gl-style-format.js +10 -4
- package/bin/gl-style-migrate.js +9 -4
- package/bin/gl-style-validate.js +16 -15
- package/deref.ts +8 -6
- package/dist/index.cjs +7771 -9448
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -11
- package/dist/index.es.js +7771 -9448
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.ts +1 -1
- package/expression/definitions/assertion.ts +1 -1
- package/expression/definitions/at_interpolated.ts +2 -1
- package/expression/definitions/case.ts +1 -1
- package/expression/definitions/coalesce.ts +1 -1
- package/expression/definitions/coercion.ts +1 -1
- package/expression/definitions/distance.ts +1 -9
- package/expression/definitions/interpolate.ts +3 -3
- package/expression/definitions/literal.ts +1 -1
- package/expression/definitions/match.ts +1 -1
- package/expression/definitions/number_format.ts +8 -6
- package/expression/definitions/within.ts +1 -8
- package/expression/evaluation_context.ts +1 -10
- package/expression/index.ts +1 -1
- package/expression/values.ts +3 -4
- package/feature_filter/index.ts +1 -1
- package/function/convert.ts +1 -1
- package/group_by_layout.ts +8 -2
- package/package.json +4 -6
- package/read_style.ts +4 -4
- package/reference/v8.json +41 -7
- package/rollup.config.js +7 -4
- package/test.js +1 -1
- package/types/config_options.ts +7 -7
- package/types/lut.ts +5 -5
- package/types/tile_id.ts +3 -3
- package/types.ts +8 -1
- package/union-to-intersection.ts +2 -2
- package/util/assert.ts +3 -0
- package/util/color.ts +33 -18
- package/util/deep_equal.ts +6 -4
- package/util/geometry_util.ts +1 -1
- package/util/lerp.ts +3 -1
- package/util/mercator.ts +16 -0
- package/util/unbundle_jsonlint.ts +3 -2
- package/validate/validate.ts +2 -0
- package/validate/validate_appearance.ts +1 -1
- package/validate/validate_color.ts +5 -2
- package/validate/validate_expression.ts +16 -8
- package/validate/validate_function.ts +3 -2
- package/validate/validate_iconset.ts +1 -1
- package/validate/validate_import.ts +7 -0
- package/validate/validate_layer.ts +4 -1
- package/validate/validate_object.ts +20 -7
- package/validate/validate_option.ts +37 -0
- package/validate/validate_terrain.ts +1 -1
- package/validate_style.ts +3 -3
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
/* eslint-disable no-process-exit */
|
|
3
3
|
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import
|
|
5
|
+
import {parseArgs} from 'util';
|
|
6
6
|
import {format, composite} from '@mapbox/mapbox-gl-style-spec';
|
|
7
7
|
|
|
8
|
-
const argv =
|
|
8
|
+
const {values: argv, positionals} = parseArgs({
|
|
9
|
+
options: {
|
|
10
|
+
help: {type: 'boolean', short: 'h'}
|
|
11
|
+
},
|
|
12
|
+
allowPositionals: true
|
|
13
|
+
});
|
|
9
14
|
|
|
10
|
-
if (argv.help ||
|
|
15
|
+
if (argv.help || (!positionals.length && process.stdin.isTTY)) {
|
|
11
16
|
help();
|
|
12
17
|
process.exit(0);
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
console.log(format(composite(JSON.parse(fs.readFileSync(
|
|
20
|
+
console.log(format(composite(JSON.parse(fs.readFileSync(positionals[0]).toString()))));
|
|
16
21
|
|
|
17
22
|
function help() {
|
|
18
23
|
console.log('usage:');
|
package/bin/gl-style-format.js
CHANGED
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
/* eslint-disable no-process-exit */
|
|
3
3
|
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import
|
|
5
|
+
import {parseArgs} from 'util';
|
|
6
6
|
import {format} from '@mapbox/mapbox-gl-style-spec';
|
|
7
7
|
|
|
8
|
-
const argv =
|
|
8
|
+
const {values: argv, positionals} = parseArgs({
|
|
9
|
+
options: {
|
|
10
|
+
space: {type: 'string'},
|
|
11
|
+
help: {type: 'boolean', short: 'h'}
|
|
12
|
+
},
|
|
13
|
+
allowPositionals: true
|
|
14
|
+
});
|
|
9
15
|
|
|
10
|
-
if (argv.help ||
|
|
16
|
+
if (argv.help || (!positionals.length && process.stdin.isTTY)) {
|
|
11
17
|
help();
|
|
12
18
|
process.exit(0);
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
console.log(format(JSON.parse(fs.readFileSync(
|
|
21
|
+
console.log(format(JSON.parse(fs.readFileSync(positionals[0]).toString()), argv.space ? Number(argv.space) : undefined));
|
|
16
22
|
|
|
17
23
|
function help() {
|
|
18
24
|
console.log('usage:');
|
package/bin/gl-style-migrate.js
CHANGED
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
/* eslint-disable no-process-exit */
|
|
3
3
|
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import
|
|
5
|
+
import {parseArgs} from 'util';
|
|
6
6
|
import {format, migrate} from '@mapbox/mapbox-gl-style-spec';
|
|
7
7
|
|
|
8
|
-
const argv =
|
|
8
|
+
const {values: argv, positionals} = parseArgs({
|
|
9
|
+
options: {
|
|
10
|
+
help: {type: 'boolean', short: 'h'}
|
|
11
|
+
},
|
|
12
|
+
allowPositionals: true
|
|
13
|
+
});
|
|
9
14
|
|
|
10
|
-
if (argv.help ||
|
|
15
|
+
if (argv.help || (!positionals.length && process.stdin.isTTY)) {
|
|
11
16
|
help();
|
|
12
17
|
process.exit(0);
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
console.log(format(migrate(JSON.parse(fs.readFileSync(
|
|
20
|
+
console.log(format(migrate(JSON.parse(fs.readFileSync(positionals[0]).toString()))));
|
|
16
21
|
|
|
17
22
|
function help() {
|
|
18
23
|
console.log('usage:');
|
package/bin/gl-style-validate.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-process-exit */
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import {parseArgs} from 'util';
|
|
6
6
|
import {validate, validateMapboxApiSupported} from '@mapbox/mapbox-gl-style-spec';
|
|
7
7
|
|
|
8
|
-
const argv =
|
|
9
|
-
|
|
8
|
+
const {values: argv, positionals} = parseArgs({
|
|
9
|
+
options: {
|
|
10
|
+
json: {type: 'boolean'},
|
|
11
|
+
'mapbox-api-supported': {type: 'boolean'},
|
|
12
|
+
help: {type: 'boolean', short: 'h'}
|
|
13
|
+
},
|
|
14
|
+
allowPositionals: true
|
|
10
15
|
});
|
|
11
16
|
|
|
12
17
|
let status = 0;
|
|
13
18
|
|
|
14
|
-
if (argv.help ||
|
|
19
|
+
if (argv.help || (!positionals.length && process.stdin.isTTY)) {
|
|
15
20
|
help();
|
|
16
21
|
process.exit(status);
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
argv._.push('/dev/stdin');
|
|
21
|
-
}
|
|
24
|
+
const files = positionals.length ? positionals : [0];
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
errors = validate(rw.readFileSync(file, 'utf8'));
|
|
29
|
-
}
|
|
26
|
+
files.forEach((file) => {
|
|
27
|
+
const source = fs.readFileSync(file, 'utf8');
|
|
28
|
+
const errors = argv['mapbox-api-supported'] ?
|
|
29
|
+
validateMapboxApiSupported(source) :
|
|
30
|
+
validate(source);
|
|
30
31
|
if (errors.length) {
|
|
31
32
|
if (argv.json) {
|
|
32
33
|
process.stdout.write(JSON.stringify(errors, null, 2));
|
package/deref.ts
CHANGED
|
@@ -5,17 +5,19 @@ import type {LayerSpecification} from './types';
|
|
|
5
5
|
function deref(layer: LayerSpecification, parent: LayerSpecification): LayerSpecification {
|
|
6
6
|
const result = {} as LayerSpecification;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const layerRec = layer as Record<string, unknown>;
|
|
9
|
+
const parentRec = parent as Record<string, unknown>;
|
|
10
|
+
const resultRec = result as Record<string, unknown>;
|
|
11
|
+
|
|
12
|
+
for (const k in layerRec) {
|
|
9
13
|
if (k !== 'ref') {
|
|
10
|
-
|
|
11
|
-
result[k] = layer[k];
|
|
14
|
+
resultRec[k] = layerRec[k];
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
refProperties.forEach((k) => {
|
|
16
|
-
if (k in
|
|
17
|
-
|
|
18
|
-
result[k] = parent[k];
|
|
19
|
+
if (k in parentRec) {
|
|
20
|
+
resultRec[k] = parentRec[k];
|
|
19
21
|
}
|
|
20
22
|
});
|
|
21
23
|
|