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

build(json-pointer): use nodenext for TypeScript modules #4452

Merged
merged 3 commits into from
Nov 8, 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
22 changes: 22 additions & 0 deletions packages/apidom-json-pointer/.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-pointer/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
4 changes: 2 additions & 2 deletions packages/apidom-json-pointer/src/compile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import escape from './escape';
import CompilationJsonPointerError from './errors/CompilationJsonPointerError';
import escape from './escape.ts';
import CompilationJsonPointerError from './errors/CompilationJsonPointerError.ts';

// compile :: String[] -> String
const compile = (tokens: string[]): string => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiDOMErrorOptions } from '@swagger-api/apidom-error';

import JsonPointerError from './JsonPointerError';
import JsonPointerError from './JsonPointerError.ts';

export interface CompilationJsonPointerErrorOptions extends ApiDOMErrorOptions {
readonly tokens: string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiDOMErrorOptions } from '@swagger-api/apidom-error';
import { Element } from '@swagger-api/apidom-core';

import JsonPointerError from './JsonPointerError';
import JsonPointerError from './JsonPointerError.ts';

export interface EvaluationJsonPointerErrorOptions<T extends Element> extends ApiDOMErrorOptions {
readonly pointer: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiDOMErrorOptions } from '@swagger-api/apidom-error';

import JsonPointerError from './JsonPointerError';
import JsonPointerError from './JsonPointerError.ts';

export interface InvalidJsonPointerErrorOptions extends ApiDOMErrorOptions {
readonly pointer: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/apidom-json-pointer/src/evaluate.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { isInteger } from 'ramda-adjunct';
import { Element, isObjectElement, isArrayElement, cloneDeep } from '@swagger-api/apidom-core';

import parse from './parse';
import EvaluationJsonPointerError from './errors/EvaluationJsonPointerError';
import parse from './parse.ts';
import EvaluationJsonPointerError from './errors/EvaluationJsonPointerError.ts';

// evaluates JSON Pointer against ApiDOM fragment
const evaluate = <T extends Element>(pointer: string, element: T): Element => {
Expand Down
24 changes: 12 additions & 12 deletions packages/apidom-json-pointer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export { default as JsonPointerError } from './errors/JsonPointerError';
export { default as InvalidJsonPointerError } from './errors/InvalidJsonPointerError';
export type { InvalidJsonPointerErrorOptions } from './errors/InvalidJsonPointerError';
export { default as CompilationJsonPointerError } from './errors/CompilationJsonPointerError';
export type { CompilationJsonPointerErrorOptions } from './errors/CompilationJsonPointerError';
export { default as EvaluationJsonPointerError } from './errors/EvaluationJsonPointerError';
export type { EvaluationJsonPointerErrorOptions } from './errors/EvaluationJsonPointerError';
export { default as escape } from './escape';
export { default as unescape } from './unescape';
export { default as parse, uriToPointer } from './parse';
export { default as compile } from './compile';
export { default as evaluate } from './evaluate';
export { default as JsonPointerError } from './errors/JsonPointerError.ts';
export { default as InvalidJsonPointerError } from './errors/InvalidJsonPointerError.ts';
export type { InvalidJsonPointerErrorOptions } from './errors/InvalidJsonPointerError.ts';
export { default as CompilationJsonPointerError } from './errors/CompilationJsonPointerError.ts';
export type { CompilationJsonPointerErrorOptions } from './errors/CompilationJsonPointerError.ts';
export { default as EvaluationJsonPointerError } from './errors/EvaluationJsonPointerError.ts';
export type { EvaluationJsonPointerErrorOptions } from './errors/EvaluationJsonPointerError.ts';
export { default as escape } from './escape.ts';
export { default as unescape } from './unescape.ts';
export { default as parse, uriToPointer } from './parse.ts';
export { default as compile } from './compile.ts';
export { default as evaluate } from './evaluate.ts';
4 changes: 2 additions & 2 deletions packages/apidom-json-pointer/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { map, pipe, split, startsWith, tail } from 'ramda';
import { isEmptyString, trimCharsStart } from 'ramda-adjunct';

import unescape from './unescape';
import InvalidJsonPointerError from './errors/InvalidJsonPointerError';
import unescape from './unescape.ts';
import InvalidJsonPointerError from './errors/InvalidJsonPointerError.ts';

// parse :: String -> String[]
const parse = (pointer: string): string[] => {
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-json-pointer/test/evaluate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import { ObjectElement, ArrayElement, StringElement } from '@swagger-api/apidom-core';

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

describe('apidom-json-pointer', function () {
context('RFC 6901 test', function () {
Expand Down
5 changes: 5 additions & 0 deletions packages/apidom-json-pointer/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