Skip to content

Commit

Permalink
build(json-path): use nodenext for TypeScript modules (#4455)
Browse files Browse the repository at this point in the history
Refs #4385
  • Loading branch information
glowcloud authored Nov 10, 2024
1 parent 43ab521 commit e5361e8
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 14 deletions.
22 changes: 22 additions & 0 deletions packages/apidom-json-path/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"settings": {
"import/resolver": {
"typescript": {
"project": ["./tsconfig.json"]
}
}
},
"rules": {
"import/extensions": [
"error",
"always",
{
"ts": "always",
"tsx": "always",
"js": "always",
"jsx": "never",
"ignorePackages": true
}
]
}
}
2 changes: 1 addition & 1 deletion packages/apidom-json-path/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint:fix": "eslint ./ --fix",
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
"typescript:check-types": "tsc --noEmit",
"typescript:declaration": "tsc -p declaration.tsconfig.json && rollup -c config/rollup/types.dist.js",
"typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js",
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
"postpack": "rimraf NOTICE LICENSES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Element } from '@swagger-api/apidom-core';
import { ApiDOMErrorOptions } from '@swagger-api/apidom-error';

import JsonPathError from './JsonPathError';
import JsonPathError from './JsonPathError.ts';

export interface EvaluationJsonPathErrorOptions<T extends Element> extends ApiDOMErrorOptions {
path: string | string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Element } from '@swagger-api/apidom-core';
import { ApiDOMErrorOptions } from '@swagger-api/apidom-error';

import JsonPathError from './JsonPathError';
import JsonPathError from './JsonPathError.ts';

export interface MultiEvaluationJsonPathErrorOptions<T extends Element> extends ApiDOMErrorOptions {
paths: string[] | string[][];
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-json-path/src/evaluate-multi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JSONPath } from 'jsonpath-plus';
import { Element, toValue, cloneDeep } from '@swagger-api/apidom-core';
import { evaluate as jsonPointerEvaluate } from '@swagger-api/apidom-json-pointer';

import MultiEvaluationJsonPathError from './errors/MultiEvaluationJsonPathError';
import MultiEvaluationJsonPathError from './errors/MultiEvaluationJsonPathError.ts';

type JSONPathEvalTuple = [string, Element[]];

Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-json-path/src/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JSONPath } from 'jsonpath-plus';
import { Element, toValue, cloneDeep } from '@swagger-api/apidom-core';
import { evaluate as jsonPointerEvaluate } from '@swagger-api/apidom-json-pointer';

import EvaluationJsonPathError from './errors/EvaluationJsonPathError';
import EvaluationJsonPathError from './errors/EvaluationJsonPathError.ts';

type Evaluate = {
<T extends Element>(path: string, element: T): Element[];
Expand Down
14 changes: 7 additions & 7 deletions packages/apidom-json-path/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './polyfills';
import './polyfills.ts';

export { default as EvaluationJsonPathError } from './errors/EvaluationJsonPathError';
export type { EvaluationJsonPathErrorOptions } from './errors/EvaluationJsonPathError';
export { default as MultiEvaluationJsonPathError } from './errors/MultiEvaluationJsonPathError';
export type { MultiEvaluationJsonPathErrorOptions } from './errors/MultiEvaluationJsonPathError';
export { default as evaluate } from './evaluate';
export { default as evaluateMulti } from './evaluate-multi';
export { default as EvaluationJsonPathError } from './errors/EvaluationJsonPathError.ts';
export type { EvaluationJsonPathErrorOptions } from './errors/EvaluationJsonPathError.ts';
export { default as MultiEvaluationJsonPathError } from './errors/MultiEvaluationJsonPathError.ts';
export type { MultiEvaluationJsonPathErrorOptions } from './errors/MultiEvaluationJsonPathError.ts';
export { default as evaluate } from './evaluate.ts';
export { default as evaluateMulti } from './evaluate-multi.ts';
2 changes: 1 addition & 1 deletion packages/apidom-json-path/test/evaluate-multi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import { ObjectElement, NumberElement } from '@swagger-api/apidom-core';

import { evaluateMulti } from '../src';
import { evaluateMulti } from '../src/index.ts';

describe('apidom-json-path', function () {
context('evaluateMulti', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-json-path/test/evaluate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import { ObjectElement, NumberElement } from '@swagger-api/apidom-core';

import { evaluate } from '../src';
import { evaluate } from '../src/index.ts';

describe('apidom-json-path', function () {
context('evaluate', function () {
Expand Down
5 changes: 5 additions & 0 deletions packages/apidom-json-path/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"allowImportingTsExtensions": true
},
"include": [
"src/**/*",
"test/**/*"
Expand Down

0 comments on commit e5361e8

Please sign in to comment.