Skip to content

Commit 52ab2f8

Browse files
committed
fix(clone): remove lodash dependency, unused dependencies
1 parent 6db025a commit 52ab2f8

File tree

8 files changed

+24
-402
lines changed

8 files changed

+24
-402
lines changed

.yarn/install-state.gz

-27 KB
Binary file not shown.

lib/normalize-args.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ function normalizeArgs(_args: Partial<IArguments>) {
3333
options = args[1];
3434
}
3535

36-
options = getNewOptions(options);
36+
try {
37+
options = getNewOptions(options);
38+
} catch (e) {
39+
console.log(e);
40+
}
3741

3842
return {
3943
path,

lib/options.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import textParser from "./parsers/text.js";
44
import binaryParser from "./parsers/binary.js";
55
import fileResolver from "./resolvers/file.js";
66
import httpResolver from "./resolvers/http.js";
7-
import cloneDeep from "lodash.clonedeep";
87

98
import type { HTTPResolverOptions, JSONSchemaObject, Plugin, ResolverOptions } from "./types/index.js";
109

@@ -104,10 +103,10 @@ const getDefaults = () => {
104103
* your own implementation, or disable any parser by setting it to false.
105104
*/
106105
parse: {
107-
json: jsonParser,
108-
yaml: yamlParser,
109-
text: textParser,
110-
binary: binaryParser,
106+
json: { ...jsonParser },
107+
yaml: { ...yamlParser },
108+
text: { ...textParser },
109+
binary: { ...binaryParser },
111110
},
112111

113112
/**
@@ -117,8 +116,8 @@ const getDefaults = () => {
117116
* your own implementation, or disable any resolver by setting it to false.
118117
*/
119118
resolve: {
120-
file: fileResolver,
121-
http: httpResolver,
119+
file: { ...fileResolver },
120+
http: { ...httpResolver },
122121

123122
/**
124123
* Determines whether external $ref pointers will be resolved.
@@ -161,7 +160,7 @@ const getDefaults = () => {
161160
referenceResolution: "relative",
162161
},
163162
} as $RefParserOptions;
164-
return cloneDeep(defaults);
163+
return defaults;
165164
};
166165

167166
export const getNewOptions = (options: DeepPartial<$RefParserOptions>): $RefParserOptions => {

lib/parsers/yaml.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default {
3333
* @returns
3434
*/
3535
async parse(file: FileInfo) {
36-
// eslint-disable-line require-await
3736
let data = file.data;
3837
if (Buffer.isBuffer(data)) {
3938
data = data.toString();

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@
6969
"devDependencies": {
7070
"@types/eslint": "8.56.5",
7171
"@types/js-yaml": "^4.0.9",
72-
"@types/node": "^20.11.24",
72+
"@types/node": "^18.19.21",
7373
"@typescript-eslint/eslint-plugin": "^7.1.1",
74-
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
7574
"@typescript-eslint/parser": "^7.1.1",
7675
"@vitest/coverage-v8": "^1.3.1",
77-
"abortcontroller-polyfill": "^1.7.5",
7876
"cross-env": "^7.0.3",
7977
"eslint": "^8.57.0",
8078
"eslint-config-prettier": "^9.1.0",
@@ -84,7 +82,6 @@
8482
"eslint-plugin-promise": "^6.1.1",
8583
"eslint-plugin-unused-imports": "^3.1.0",
8684
"jsdom": "^24.0.0",
87-
"lint-staged": "^15.2.2",
8885
"node-fetch": "^3.3.2",
8986
"prettier": "^3.2.5",
9087
"rimraf": "^5.0.5",
@@ -94,9 +91,7 @@
9491
"dependencies": {
9592
"@jsdevtools/ono": "^7.1.3",
9693
"@types/json-schema": "^7.0.15",
97-
"@types/lodash.clonedeep": "^4.5.9",
98-
"js-yaml": "^4.1.0",
99-
"lodash.clonedeep": "^4.5.0"
94+
"js-yaml": "^4.1.0"
10095
},
10196
"release": {
10297
"branches": [

test/fixtures/polyfill.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

vite.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ export default defineConfig({
55
test: {
66
environment: isBrowser ? "jsdom" : "node",
77
dir: "test",
8-
exclude: ["**/__IGNORED__/**"],
98
watch: false,
109
globalSetup: isBrowser ? ["./test/fixtures/server.ts"] : undefined,
11-
setupFiles: isBrowser ? ["./test/fixtures/polyfill.ts"] : undefined,
1210
testTimeout: 5000,
1311
globals: true,
1412
passWithNoTests: true,

0 commit comments

Comments
 (0)