Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use with for json modules instead of assert #675

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- _...Add new stuff here..._

### 🐞 Bug fixes
- _...Add new stuff here..._
- Change `assert` to `with` in JSON modules. Requires Node.js 18.20.0 or later, and supports Node.js 22.0.0 or later - [#675](https://github.com/maplibre/maplibre-style-spec/pull/675)

## 20.2.0

Expand Down
2 changes: 1 addition & 1 deletion build/generate-docs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import v8 from '../src/reference/v8.json' assert { type: 'json' };
import v8 from '../src/reference/v8.json' with { type: 'json' };
import fs from 'fs';
import jsonStringify from 'json-stringify-pretty-compact';

Expand Down
2 changes: 1 addition & 1 deletion build/generate-style-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as properties from '../src/util/properties';

import spec from '../src/reference/v8.json' assert {type: 'json'};
import spec from '../src/reference/v8.json' with {type: 'json'};

function unionType(values) {
if (Array.isArray(values)) {
Expand Down
2 changes: 1 addition & 1 deletion src/expression/expression.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {createPropertyExpression, Feature, GlobalProperties, StylePropertyExpression} from '../expression';
import definitions from './definitions';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};
import {createExpression, ICanonicalTileID, StyleExpression, StylePropertySpecification} from '..';
import ParsingError from './parsing_error';
import {VariableAnchorOffsetCollection} from './values';
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export type StylePropertySpecification = {
default?: VariableAnchorOffsetCollectionSpecification;
};

import v8Spec from './reference/v8.json' assert {type: 'json'};
import v8Spec from './reference/v8.json' with {type: 'json'};
const v8 = v8Spec as any;
import latest from './reference/latest';
import derefLayers from './deref';
Expand Down
2 changes: 1 addition & 1 deletion src/migrate.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import migrate from './migrate';
import * as spec from '.';
import v8 from './reference/v8.json' assert {type: 'json'};
import v8 from './reference/v8.json' with {type: 'json'};
import validate from './validate_style';

describe('migrate', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/reference/latest.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

import spec from './v8.json' assert { type: 'json' };
import spec from './v8.json' with { type: 'json' };
export default spec as any;
2 changes: 1 addition & 1 deletion src/validate/validate_raster_dem_source.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import validateSpec from './validate';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};
import validateRasterDEMSource from './validate_raster_dem_source';
import {RasterDEMSourceSpecification} from '../types.g';

Expand Down
2 changes: 1 addition & 1 deletion src/validate/validate_raster_dem_source.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ValidationError from '../error/validation_error';
import getType from '../util/get_type';
import type {RasterDEMSourceSpecification, StyleSpecification} from '../types.g';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};
import {unbundle} from '../util/unbundle_jsonlint';

interface ValidateRasterDENSourceOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/validate/validate_sky.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import validateSky from './validate_sky';
import validateSpec from './validate';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};
import {SkySpecification} from '../types.g';

describe('Validate sky', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/validate/validate_sky.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ValidationError from '../error/validation_error';
import getType from '../util/get_type';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};
import {SkySpecification, StyleSpecification} from '../types.g';

interface ValidateSkyOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/validate/validate_terrain.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import validateSpec from './validate';
import validateTerrain from './validate_terrain';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};

describe('Validate Terrain', () => {
test('Should return error in case terrain is not an object', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/validate/validate_terrain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ValidationError from '../error/validation_error';
import getType from '../util/get_type';
import type {StyleSpecification, TerrainSpecification} from '../types.g';
import v8 from '../reference/v8.json' assert {type: 'json'};
import v8 from '../reference/v8.json' with {type: 'json'};

export default function validateTerrain(
options: {value: TerrainSpecification; styleSpec: typeof v8; style: StyleSpecification; validateSpec: Function}
Expand Down
2 changes: 1 addition & 1 deletion src/visit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Reference from './reference/v8.json' assert {type: 'json'};
import Reference from './reference/v8.json' with {type: 'json'};
import type {StylePropertySpecification} from '.';
import type {
StyleSpecification,
Expand Down