Skip to content

Commit

Permalink
chore: remove some deps used by benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed May 2, 2024
1 parent 5772a2e commit 8aa4726
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 130 deletions.
13 changes: 8 additions & 5 deletions benchmarks/utils/hook.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import * as fs from 'node:fs/promises';
const { dependencies } = JSON.parse(
await fs.readFile('../../package.json', 'utf8'),
);
const dependencies = [
'@jsep-plugin/regex',
'@jsep-plugin/ternary',
'jsep',
'astring',
];

export async function resolve(specifier, context, nextResolve) {
if (Object.hasOwn(dependencies, specifier)) {
if (dependencies.includes(specifier)) {
return nextResolve(`https://cdn.skypack.dev/${specifier}`, context);
}

Expand Down
6 changes: 4 additions & 2 deletions benchmarks/utils/load-document.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export default async function loadDocument(scenario, document) {
if (!document) {
assert.ok(scenario.defaultDocument);
const { fileURLToPath } = await import('node:url');
const { JSONSchemaFaker } = await import('json-schema-faker');
const { JSONSchemaFaker } = await import(
'https://cdn.skypack.dev/json-schema-faker'
);
const cwd = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');

const schema = JSON.parse(
Expand All @@ -17,7 +19,7 @@ export default async function loadDocument(scenario, document) {
return JSONSchemaFaker.generate(schema);
}

const yaml = await import('js-yaml');
const yaml = await import('https://cdn.skypack.dev://js-yaml');

if (document.startsWith('https://')) {
return yaml.load(await (await fetch(document)).text());
Expand Down
136 changes: 15 additions & 121 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
"eslint-plugin-simple-import-sort": "^12.1.0",
"husky": "^9.0.10",
"iso-bench": "^2.4.7",
"js-yaml": "^4.1.0",
"json-schema-faker": "^0.5.5",
"jsonpath-plus": "^8.0.0",
"lodash-es": "^4.17.21",
"prettier": "^3.2.5",
Expand Down

0 comments on commit 8aa4726

Please sign in to comment.