New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@secretlint/core

Package Overview
Dependencies
Maintainers
0
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@secretlint/core - npm Package Compare versions

Comparing version 9.1.0 to 9.2.0

6

module/index.d.ts

@@ -23,2 +23,8 @@ import type { SecretLintCoreConfig, SecretLintCoreResult, SecretLintRawSource, SecretLintRuleLocaleTag } from "@secretlint/types";

config: SecretLintCoreConfig;
/**
* If pass the `source` come from non-physical file such as stdin, you can set `noPhysicFilePath` to true.
* This option affect to `context.getSourceFilePath()`.
* If pass `noPhysicFilePath: true`, `context.getSourceFilePath()` return `undefined`.
*/
noPhysicFilePath?: boolean;
};

@@ -25,0 +31,0 @@ };

1

module/index.js

@@ -34,2 +34,3 @@ import { SecretLintSourceCodeImpl } from "./SecretLintSourceCodeImpl.js";

filePath: source.filePath,
physicalFilePath: options.noPhysicFilePath ? undefined : source.filePath,
ext: source.ext || "",

@@ -36,0 +37,0 @@ contentType: source.contentType,

@@ -9,13 +9,20 @@ import { SecretLintSourceCode, SecretLintSourceNodeLocation, SecretLintSourceNodePosition, SecretLintSourceNodeRange } from "@secretlint/types";

readonly filePath: string | undefined;
readonly physicalFilePath: string | undefined;
readonly contentType: "binary" | "text" | "unknown";
readonly ext: string;
private structuredSource;
constructor({ content, ext, filePath, contentType, }: {
constructor({ content, ext, filePath, physicalFilePath, contentType, }: {
content: string;
ext: string;
filePath: string;
physicalFilePath: string | undefined;
contentType: "binary" | "text" | "unknown";
});
/**
* get filePath
* get file path
* This return `undefined` if the source code is created without file path.
* For example, use core API to create a source code directly.
*
* You can use this path to detect file type.
* However, if you want to read the file content, use `getPhysicalFilePath` instead.
* @returns {string|undefined}

@@ -25,2 +32,10 @@ */

/**
* get physical file path
* This return `undefined` if the source code is not related to file.
* For example, the source code is given from the stdin.
*
* You can use this path to read the file content.
*/
getPhysicalFilePath(): string | undefined;
/**
* @param {SecretLintSourceNodeLocation} loc - location indicator.

@@ -27,0 +42,0 @@ * @return {[ number, number ]} range.

@@ -10,6 +10,7 @@ import { StructuredSource } from "structured-source";

filePath;
physicalFilePath;
contentType;
ext;
structuredSource;
constructor({ content = "", ext, filePath, contentType, }) {
constructor({ content = "", ext, filePath, physicalFilePath, contentType, }) {
invariant(ext || filePath, "should be set either of fileExt or filePath.");

@@ -20,2 +21,3 @@ this.hasBOM = content.charCodeAt(0) === 0xfeff;

this.filePath = filePath;
this.physicalFilePath = physicalFilePath;
this.contentType = contentType;

@@ -25,3 +27,8 @@ this.ext = ext;

/**
* get filePath
* get file path
* This return `undefined` if the source code is created without file path.
* For example, use core API to create a source code directly.
*
* You can use this path to detect file type.
* However, if you want to read the file content, use `getPhysicalFilePath` instead.
* @returns {string|undefined}

@@ -33,2 +40,12 @@ */

/**
* get physical file path
* This return `undefined` if the source code is not related to file.
* For example, the source code is given from the stdin.
*
* You can use this path to read the file content.
*/
getPhysicalFilePath() {
return this.physicalFilePath;
}
/**
* @param {SecretLintSourceNodeLocation} loc - location indicator.

@@ -35,0 +52,0 @@ * @return {[ number, number ]} range.

8

package.json
{
"name": "@secretlint/core",
"version": "9.1.0",
"version": "9.2.0",
"description": "Core library for @secretlint.",

@@ -55,4 +55,4 @@ "keywords": [

"dependencies": {
"@secretlint/profiler": "^9.1.0",
"@secretlint/types": "^9.1.0",
"@secretlint/profiler": "^9.2.0",
"@secretlint/types": "^9.2.0",
"debug": "^4.4.0",

@@ -79,3 +79,3 @@ "structured-source": "^4.0.0"

},
"gitHead": "10dc170e39c02aeb77f5c8aa8d0216028477f07d"
"gitHead": "97d1d5b8c7e33190af2f35c8eba54356712870cd"
}

@@ -20,2 +20,3 @@ import type {

import debug0 from "debug";
const debug = debug0("@secretlint/core");

@@ -43,2 +44,8 @@ export type SecretLintSourceOptions = {

config: SecretLintCoreConfig;
/**
* If pass the `source` come from non-physical file such as stdin, you can set `noPhysicFilePath` to true.
* This option affect to `context.getSourceFilePath()`.
* If pass `noPhysicFilePath: true`, `context.getSourceFilePath()` return `undefined`.
*/
noPhysicFilePath?: boolean;
};

@@ -71,2 +78,3 @@ };

filePath: source.filePath,
physicalFilePath: options.noPhysicFilePath ? undefined : source.filePath,
ext: source.ext || "",

@@ -73,0 +81,0 @@ contentType: source.contentType,

@@ -17,2 +17,3 @@ import { StructuredSource } from "structured-source";

readonly filePath: string | undefined;
readonly physicalFilePath: string | undefined;
readonly contentType: "binary" | "text" | "unknown";

@@ -26,2 +27,3 @@ readonly ext: string;

filePath,
physicalFilePath,
contentType,

@@ -32,2 +34,3 @@ }: {

filePath: string;
physicalFilePath: string | undefined;
contentType: "binary" | "text" | "unknown";

@@ -40,2 +43,3 @@ }) {

this.filePath = filePath;
this.physicalFilePath = physicalFilePath;
this.contentType = contentType;

@@ -46,6 +50,11 @@ this.ext = ext;

/**
* get filePath
* get file path
* This return `undefined` if the source code is created without file path.
* For example, use core API to create a source code directly.
*
* You can use this path to detect file type.
* However, if you want to read the file content, use `getPhysicalFilePath` instead.
* @returns {string|undefined}
*/
getFilePath() {
getFilePath(): string | undefined {
return this.filePath;

@@ -55,2 +64,13 @@ }

/**
* get physical file path
* This return `undefined` if the source code is not related to file.
* For example, the source code is given from the stdin.
*
* You can use this path to read the file content.
*/
getPhysicalFilePath(): string | undefined {
return this.physicalFilePath;
}
/**
* @param {SecretLintSourceNodeLocation} loc - location indicator.

@@ -57,0 +77,0 @@ * @return {[ number, number ]} range.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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