Socket
Socket
Sign inDemoInstall

pure-index

Package Overview
Dependencies
21
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.55 to 0.0.56

2

dist/fileTraversal/processBatch/traversal/index.d.ts
import type { Config } from '../../../getConfig/index.js';
import type { Cmd, Pkg } from '../../../shared/index.js';
import { type Cmd, type Pkg } from '../../../shared/index.js';
type Params = {

@@ -4,0 +4,0 @@ path: string;

import { parseFile } from '@swc/core';
import { printParseError } from '../../../shared/index.js';
const traversal = async ({ path, pkg, cmd, config }) => {
const ast = await parseFile(path, config.parserConfig);
let ast;
try {
ast = await parseFile(path, config.parserConfig);
}
catch (e) {
printParseError(path);
process.exit(1);
}
for (const node of ast.body) {

@@ -5,0 +13,0 @@ if (node.type === 'ImportDeclaration' && node.source.value === pkg.name) {

import { existsSync } from 'node:fs';
import { parseFile } from '@swc/core';
import { ObservableSet, printError as _printError, Err } from '../shared/index.js';
import { ObservableSet, printError as _printError, printParseError } from '../shared/index.js';
const printError = (pkg) => {
_printError({
text: `
Can't find ${pkg.name} index file ("${pkg.path}" provided)
Unable to find ${pkg.name} index file ("${pkg.path}" provided)
- if you do not have a .pure-index.json file:
create one and specify "entry"
https://space307.github.io/pure-index/reference/configuration
create one and specify "entry"
https://space307.github.io/pure-index/reference/configuration
- if you have a configuration file:
use the pure-index command with the "--entry" flag.
https://space307.github.io/pure-index/how-to/precisely-override-package-entry
use the pure-index command with the "--entry" flag.
https://space307.github.io/pure-index/how-to/precisely-override-package-entry
`,

@@ -22,6 +22,13 @@ });

printError(pkg);
throw new Error('invalid_entry');
process.exit(1);
}
const result = new ObservableSet();
const ast = await parseFile(pkg.path, config.parserConfig);
let ast;
try {
ast = await parseFile(pkg.path, config.parserConfig);
}
catch (e) {
printParseError(pkg.path);
}
// @ts-expect-error
for (const node of ast.body) {

@@ -28,0 +35,0 @@ if (node.type === 'ExportNamedDeclaration') {

@@ -8,2 +8,3 @@ import type { ObservableSet } from './observableSet.js';

}) => void;
declare const printParseError: (path: Pkg['path']) => void;
declare const Ok: <T>(val: T) => {

@@ -24,3 +25,3 @@ readonly ok: true;

type Cmd = (_: string) => unknown;
export { readJSON, printError, Ok, Err, printSet };
export { readJSON, printError, printParseError, Ok, Err, printSet };
export { getRepoRoot } from './getRepoRoot.js';

@@ -27,0 +28,0 @@ export { ObservableSet } from './observableSet.js';

@@ -12,7 +12,15 @@ import { readFile } from 'node:fs/promises';

};
const printParseError = (path) => printError({
text: `
Unable to parse ${path}
Please refer to the documentation to learn how to configure "parserConfig":
https://space307.github.io/pure-index/reference/configuration#parserconfig
`,
});
const Ok = (val) => ({ ok: true, val });
const Err = (err) => ({ ok: false, err });
export { readJSON, printError, Ok, Err, printSet };
export { readJSON, printError, printParseError, Ok, Err, printSet };
export { getRepoRoot } from './getRepoRoot.js';
export { ObservableSet } from './observableSet.js';
export { createSpinner } from 'nanospinner';
{
"name": "pure-index",
"type": "module",
"version": "0.0.55",
"version": "0.0.56",
"description": "Utility for monorepos. It helps to clean your packages of unused exports with ease",

@@ -6,0 +6,0 @@ "main": "./dist/api/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc