Socket
Socket
Sign inDemoInstall

@arktype/attest

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arktype/attest - npm Package Compare versions

Comparing version 0.7.5 to 0.7.6

LICENSE

20

out/bench/bench.js

@@ -208,12 +208,10 @@ import { caller } from "@arktype/fs";

});
export const getBenchCtx = (qualifiedPath, isAsync = false, options = {}) => {
return {
qualifiedPath,
qualifiedName: qualifiedPath.join("/"),
options,
cfg: getConfig(),
benchCallPosition: caller(),
lastSnapCallPosition: undefined,
isAsync
};
};
export const getBenchCtx = (qualifiedPath, isAsync = false, options = {}) => ({
qualifiedPath,
qualifiedName: qualifiedPath.join("/"),
options,
cfg: getConfig(),
benchCallPosition: caller(),
lastSnapCallPosition: undefined,
isAsync
});

@@ -5,8 +5,6 @@ export const stringifyMeasure = ([value, units]) => units in timeUnitRatios ?

export const TYPE_UNITS = ["instantiations"];
export const createTypeComparison = (value, baseline) => {
return {
updated: [value, "instantiations"],
baseline
};
};
export const createTypeComparison = (value, baseline) => ({
updated: [value, "instantiations"],
baseline
});
export const timeUnitRatios = {

@@ -13,0 +11,0 @@ ns: 0.000_001,

@@ -53,12 +53,11 @@ import { readJson } from "@arktype/fs";

}
const matchingAssertion = assertions[fileKey].find(assertion => {
/**
* Depending on the environment, a trace can refer to any of these points
* attest(...)
* ^ ^ ^
* Because of this, it's safest to check if the call came from anywhere in the expected range.
*
*/
return isPositionWithinRange(position, assertion.location);
});
const matchingAssertion = assertions[fileKey].find(assertion =>
/**
* Depending on the environment, a trace can refer to any of these points
* attest(...)
* ^ ^ ^
* Because of this, it's safest to check if the call came from anywhere in the expected range.
*
*/
isPositionWithinRange(position, assertion.location));
if (!matchingAssertion) {

@@ -65,0 +64,0 @@ throw new Error(`Found no assertion for TypeScript version ${version} at line ${position.line} char ${position.char} in '${fileKey}'.

@@ -21,3 +21,5 @@ import { fromCwd } from "@arktype/fs";

const tsLibPaths = getTsLibFiles(tsConfigInfo.parsed.options);
this.rootFiles = tsConfigInfo.parsed.fileNames.filter(path => path.startsWith(fromCwd()));
// TS represents windows paths as `C:/Users/ssalb/...`
const normalizedCwd = fromCwd().replaceAll(/\\/g, "/");
this.rootFiles = tsConfigInfo.parsed.fileNames.filter(path => path.startsWith(normalizedCwd));
const system = tsvfs.createFSBackedSystem(tsLibPaths.defaultMapFromNodeModules, dirname(this.tsConfigInfo.path), ts);

@@ -28,3 +30,4 @@ this.virtualEnv = tsvfs.createVirtualTypeScriptEnvironment(system, this.rootFiles, ts, this.tsConfigInfo.parsed.options);

getSourceFileOrThrow(path) {
const file = this.virtualEnv.getSourceFile(path);
const tsPath = path.replaceAll(/\\/g, "/");
const file = this.virtualEnv.getSourceFile(tsPath);
if (!file)

@@ -31,0 +34,0 @@ throw new Error(`Could not find ${path}.`);

@@ -6,20 +6,16 @@ import { ensureDir, fromCwd } from "@arktype/fs";

import { findAttestTypeScriptVersions } from "./tsVersioning.js";
export const getDefaultAttestConfig = () => {
return {
tsconfig: existsSync(fromCwd("tsconfig.json")) ?
fromCwd("tsconfig.json")
: undefined,
attestAliases: ["attest", "attestInternal"],
updateSnapshots: false,
skipTypes: false,
skipInlineInstantiations: false,
tsVersions: "typescript",
benchPercentThreshold: 20,
benchErrorOnThresholdExceeded: false,
filter: undefined,
testDeclarationAliases: ["bench", "it"],
formatter: `npm exec --no -- prettier --write`,
shouldFormat: true
};
};
export const getDefaultAttestConfig = () => ({
tsconfig: existsSync(fromCwd("tsconfig.json")) ? fromCwd("tsconfig.json") : undefined,
attestAliases: ["attest", "attestInternal"],
updateSnapshots: false,
skipTypes: false,
skipInlineInstantiations: false,
tsVersions: "typescript",
benchPercentThreshold: 20,
benchErrorOnThresholdExceeded: false,
filter: undefined,
testDeclarationAliases: ["bench", "it"],
formatter: `npm exec --no -- prettier --write`,
shouldFormat: true
});
const hasFlag = (flag) => process.argv.some(arg => arg.includes(flag));

@@ -26,0 +22,0 @@ const getParamValue = (param) => {

import { type AttestConfig } from "./config.js";
export declare const setup: (options?: Partial<AttestConfig>) => void;
export declare const setup: (options?: Partial<AttestConfig>) => typeof teardown;
export declare const writeAssertionData: (toPath: string) => void;

@@ -4,0 +4,0 @@ export declare const cleanup: () => void;

@@ -14,3 +14,3 @@ import { shell, writeJson } from "@arktype/fs";

if (config.skipTypes)
return;
return teardown;
if (config.tsVersions.length === 1 &&

@@ -22,2 +22,3 @@ config.tsVersions[0].alias === "typescript")

}
return teardown;
};

@@ -24,0 +25,0 @@ export const writeAssertionData = (toPath) => {

{
"name": "@arktype/attest",
"version": "0.7.5",
"author": {
"name": "David Blass",
"email": "david@arktype.io",
"url": "https://arktype.io"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"exports": {
".": {
"types": "./out/api.d.ts",
"default": "./out/api.js"
},
"./internal/*": {
"default": "./out/*"
}
},
"files": [
"out"
],
"bin": {
"attest": "./out/cli/cli.js"
},
"scripts": {
"build": "tsx ../repo/build.ts",
"test": "tsx ../repo/testPackage.ts",
"bunTest": "bun test --preload ../repo/bunTestSetup.ts"
},
"dependencies": {
"arktype": "2.0.0-dev.11",
"@arktype/fs": "0.0.19",
"@arktype/util": "0.0.41",
"@typescript/vfs": "1.5.0",
"@typescript/analyze-trace": "0.10.1"
},
"devDependencies": {
"typescript": "5.4.5"
},
"peerDependencies": {
"typescript": "*"
}
}
"name": "@arktype/attest",
"version": "0.7.6",
"author": {
"name": "David Blass",
"email": "david@arktype.io",
"url": "https://arktype.io"
},
"type": "module",
"main": "./out/api.js",
"types": "./out/api.d.ts",
"exports": {
".": "./out/api.js",
"./internal/*": "./out/*"
},
"files": [
"out"
],
"bin": {
"attest": "out/cli/cli.js"
},
"dependencies": {
"arktype": "2.0.0-dev.13",
"@typescript/vfs": "1.5.0",
"@typescript/analyze-trace": "0.10.1",
"@arktype/fs": "0.0.20",
"@arktype/util": "0.0.44"
},
"devDependencies": {
"typescript": "5.4.5"
},
"peerDependencies": {
"typescript": "*"
},
"scripts": {
"build": "tsx ../repo/build.ts",
"test": "tsx ../repo/testPackage.ts",
"bunTest": "bun test --preload ../repo/bunTestSetup.ts"
}
}

@@ -43,5 +43,3 @@ # Attest

// config options can be passed here
export const setup = () => setup({})
export const teardown = teardown
export default () => setup({})
```

@@ -128,2 +126,17 @@

})
it("integrated type performance benchmarking", () => {
const user = type({
kind: "'admin'",
"powers?": "string[]"
})
.or({
kind: "'superadmin'",
"superpowers?": "string[]"
})
.or({
kind: "'pleb'"
})
attest.instantiations([7574, "instantiations"])
})
})

@@ -130,0 +143,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc