Skip to content

Commit

Permalink
NodeNext Compat (#1224)
Browse files Browse the repository at this point in the history
* Add file extension to imports/exports

This fixes compat with TypeScript's NodeNext module resolution.

* Remove ESLint import plugins

* 1.0.5-0

* Remove eslint-plugin-import package

* Fixup prettier scripts and issues

It seems like the prettier API has changed and it is no longer possible to combine --list-different and --write.
  • Loading branch information
arturmuller committed Jun 20, 2024
1 parent f24c3cd commit 3fe2139
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 24 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "superstruct",
"description": "A simple and composable way to validate data in JavaScript (and TypeScript).",
"version": "1.0.4",
"version": "1.0.5-0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/superstruct.git",
"type": "module",
Expand Down Expand Up @@ -49,10 +49,10 @@
"clean": "rm -rf ./{dist,node_modules}",
"fix": "npm run fix:eslint && npm run fix:prettier",
"fix:eslint": "npm run lint:eslint --fix",
"fix:prettier": "npm run lint:prettier --write",
"fix:prettier": "prettier '**/*.{js,json,ts}' --write",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint '{src,test}/*.{js,ts}'",
"lint:prettier": "prettier --list-different '**/*.{js,json,ts}'",
"lint:prettier": "prettier '**/*.{js,json,ts}' --check",
"release": "npm run build && npm run lint && np",
"test": "npm run build && npm run test:types && npm run test:vitest",
"test:types": "tsc --noEmit && tsc --project ./test/tsconfig.json --noEmit",
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './error'
export * from './struct'
export * from './structs/coercions'
export * from './structs/refinements'
export * from './structs/types'
export * from './structs/utilities'
export * from './error.js'
export * from './struct.js'
export * from './structs/coercions.js'
export * from './structs/refinements.js'
export * from './structs/types.js'
export * from './structs/utilities.js'
4 changes: 2 additions & 2 deletions src/struct.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toFailures, shiftIterator, StructSchema, run } from './utils'
import { StructError, Failure } from './error'
import { toFailures, shiftIterator, StructSchema, run } from './utils.js'
import { StructError, Failure } from './error.js'

/**
* `Struct` objects encapsulate the validation logic for a specific type of
Expand Down
6 changes: 3 additions & 3 deletions src/structs/coercions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Struct, is, Coercer } from '../struct'
import { isPlainObject } from '../utils'
import { string, unknown } from './types'
import { Struct, is, Coercer } from '../struct.js'
import { isPlainObject } from '../utils.js'
import { string, unknown } from './types.js'

/**
* Augment a `Struct` to add an additional coercion step to its input.
Expand Down
4 changes: 2 additions & 2 deletions src/structs/refinements.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Struct, Refiner } from '../struct'
import { toFailures } from '../utils'
import { Struct, Refiner } from '../struct.js'
import { toFailures } from '../utils.js'

/**
* Ensure that a string, array, map, or set is empty.
Expand Down
6 changes: 3 additions & 3 deletions src/structs/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Infer, Struct } from '../struct'
import { define } from './utilities'
import { Infer, Struct } from '../struct.js'
import { define } from './utilities.js'
import {
ObjectSchema,
ObjectType,
Expand All @@ -9,7 +9,7 @@ import {
AnyStruct,
InferStructTuple,
UnionToIntersection,
} from '../utils'
} from '../utils.js'

/**
* Ensure that any value passes validation.
Expand Down
11 changes: 8 additions & 3 deletions src/structs/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Context, Struct, Validator } from '../struct'
import { Assign, ObjectSchema, ObjectType, PartialObjectSchema } from '../utils'
import { object, optional, type } from './types'
import { Context, Struct, Validator } from '../struct.js'
import {
Assign,
ObjectSchema,
ObjectType,
PartialObjectSchema,
} from '../utils.js'
import { object, optional, type } from './types.js'

/**
* Create a new struct that combines the properties properties from multiple
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Struct, Infer, Result, Context, Describe } from './struct'
import { Failure } from './error'
import { Struct, Infer, Result, Context, Describe } from './struct.js'
import { Failure } from './error.js'

/**
* Check if a value is an iterator.
Expand Down

0 comments on commit 3fe2139

Please sign in to comment.