Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@philidem/rewrite-relative-paths

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@philidem/rewrite-relative-paths - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

readIgnoreFiles.d.ts

4

cli/rewrite-imports.d.ts

@@ -1,2 +0,2 @@

import yargs from 'yargs';
export declare function run(): Promise<yargs.Argv<{}> | undefined>;
#!/usr/bin/env node
export {};

@@ -0,1 +1,2 @@

#!/usr/bin/env node
"use strict";

@@ -6,6 +7,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
/* istanbul ignore file */
const chalk_1 = __importDefault(require("chalk"));
const yargs_1 = __importDefault(require("yargs"));
const rewriteImports_1 = __importDefault(require("../rewriteImports"));
const rewriteImports_1 = require("../rewriteImports");
async function run() {

@@ -29,3 +30,3 @@ const input = yargs_1.default

}
await rewriteImports_1.default({
await (0, rewriteImports_1.rewriteImports)({
dir: input.dir,

@@ -36,3 +37,5 @@ files: input._,

}
exports.run = run;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZS1pbXBvcnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9yZXdyaXRlLWltcG9ydHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsMEJBQTBCO0FBQzFCLGtEQUEwQjtBQUMxQix1RUFBK0M7QUFFeEMsS0FBSyxVQUFVLEdBQUc7SUFDdkIsTUFBTSxLQUFLLEdBQUcsZUFBSztTQUNoQixNQUFNLENBQUMsR0FBRyxFQUFFO1FBQ1gsS0FBSyxFQUFFLEtBQUs7UUFDWixJQUFJLEVBQUUsUUFBUTtRQUNkLF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csIHtcbiAgICAgIGFsaWFzOiAnaGVscCcsXG4gICAgICB0eXBlOiAnYm9vbGVhbicsXG4gICAgfSkuYXJndiBhcyB7XG4gICAgZGlyPzogc3RyaW5nO1xuICAgIG1vbm9yZXBvPzogYm9vbGVhbjtcbiAgICBoZWxwPzogYm9vbGVhbjtcbiAgICBfOiBzdHJpbmdbXTtcbiAgfTtcblxuICBpZiAoaW5wdXQuaGVscCkge1xuICAgIHJldHVybiB5YXJncy5zaG93SGVscCgpO1xuICB9XG5cbiAgYXdhaXQgcmV3cml0ZUltcG9ydHMoe1xuICAgIGRpcjogaW5wdXQuZGlyISxcbiAgICBmaWxlczogaW5wdXQuXyxcbiAgICBtb25vcmVwbzogaW5wdXQubW9ub3JlcG8gPT09IHRydWUsXG4gIH0pO1xufVxuIl19
run().catch((err) => {
console.error(chalk_1.default.red(`${chalk_1.default.bold('Error running command')}. Error: ${err.stack}`));
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZS1pbXBvcnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9yZXdyaXRlLWltcG9ydHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBRUEsMEJBQTBCO0FBQzFCLGtEQUEwQjtBQUMxQixrREFBMEI7QUFDMUIsc0RBQXNEO0FBRXRELEtBQUssVUFBVSxHQUFHO0lBQ2hCLE1BQU0sS0FBSyxHQUFHLGVBQUs7U0FDaEIsTUFBTSxDQUFDLEdBQUcsRUFBRTtRQUNYLEtBQUssRUFBRSxLQUFLO1FBQ1osSUFBSSxFQUFFLFFBQVE7UUFDZCxRQUFRLEVBQUUsSUFBSTtLQUNmLENBQUM7U0FDRCxNQUFNLENBQUMsVUFBVSxFQUFFO1FBQ2xCLElBQUksRUFBRSxTQUFTO1FBQ2YsUUFBUSxFQUFFLEtBQUs7S0FDaEIsQ0FBQ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HR5cGU6ICdzdHJpbmcnLFxuICAgICAgcmVxdWlyZWQ6IHRydWUsXG4gICAgfSlcbiAgICAub3B0aW9uKCdtb25vcmVwbycsIHtcbiAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgIHJlcXVpcmVkOiBmYWxzZSxcbiAgICB9KVxuICAgIC5vcHRpb24oJ2gnLCB7XG4gICAgICBhbGlhczogJ2hlbHAnLFxuICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgIH0pLmFyZ3YgYXMge1xuICAgIGRpcj86IHN0cmluZztcbiAgICBtb25vcmVwbz86IGJvb2xlYW47XG4gICAgaGVscD86IGJvb2xlYW47XG4gICAgXzogc3RyaW5nW107XG4gIH07XG5cbiAgaWYgKGlucHV0LmhlbHApIHtcbiAgICByZXR1cm4geWFyZ3Muc2hvd0hlbHAoKTtcbiAgfVxuXG4gIGF3YWl0IHJld3JpdGVJbXBvcnRzKHtcbiAgICBkaXI6IGlucHV0LmRpciEsXG4gICAgZmlsZXM6IGlucHV0Ll8sXG4gICAgbW9ub3JlcG86IGlucHV0Lm1vbm9yZXBvID09PSB0cnVlLFxuICB9KTtcbn1cblxucnVuKCkuY2F0Y2goKGVycikgPT4ge1xuICBjb25zb2xlLmVycm9yKFxuICAgIGNoYWxrLnJlZChgJHtjaGFsay5ib2xkKCdFcnJvciBydW5uaW5nIGNvbW1hbmQnKX0uIEVycm9yOiAke2Vyci5zdGFja31gKVxuICApO1xufSk7XG5cIi4uL3Jld3JpdGVJbXBvcnRzXCIiXX0=

@@ -1,2 +0,2 @@

import yargs from 'yargs';
export declare function run(): Promise<yargs.Argv<{}> | undefined>;
#!/usr/bin/env node
export {};

@@ -0,1 +1,2 @@

#!/usr/bin/env node
"use strict";

@@ -6,6 +7,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
/* istanbul ignore file */
const chalk_1 = __importDefault(require("chalk"));
const yargs_1 = __importDefault(require("yargs"));
const rewriteRequires_1 = __importDefault(require("../rewriteRequires"));
const rewriteRequires_1 = require("../rewriteRequires");
async function run() {

@@ -25,7 +26,9 @@ const input = yargs_1.default

}
await rewriteRequires_1.default({
await (0, rewriteRequires_1.rewriteRequires)({
dir: input.dir,
});
}
exports.run = run;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZS1yZXF1aXJlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvcmV3cml0ZS1yZXF1aXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSwwQkFBMEI7QUFDMUIsa0RBQTBCO0FBQzFCLHlFQUFpRDtBQUUxQyxLQUFLLFVBQVUsR0FBRztJQUN2QixNQUFNLEtBQUssR0FBRyxlQUFLO1NBQ2hCLE1BQU0sQ0FBQyxHQUFHLEVBQUU7UUFDWCxLQUFLLEVBQUUsS0FBSztRQUNaLElBQUksRUFBRSxRQUFRO1FBQ2QsUUFBUSxFQUFFLElBQUk7S0FDZixDQUFDO1NBQ0QsTUFBTSxDQUFDLEdBQUcsRUFBRTtRQUNYLEtBQUssRUFBRSxNQUFNO1FBQ2IsSUFBSSxFQUFFLFNBQVM7S0FDaEIsQ0FBQyxDQUFDLElBSUosQ0FBQztJQUVGLElBQUksS0FBSyxDQUFDLElBQUksRUFBRTtRQUNkLE9BQU8sZUFBSyxDQUFDLFFBQVEsRUFBRSxDQUFDO0tBQ3pCO0lBRUQsTUFBTSx5QkFBZSxDQUFDO1FBQ3BCLEdBQUcsRUFBRSxLQUFLLENBQUMsR0FBSTtLQUNoQixDQUFDLENBQUM7QUFDTCxDQUFDO0FBdkJELGtCQXVCQyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGlzdGFuYnVsIGlnbm9yZSBmaWxlICovXG5pbXBvcnQgeWFyZ3MgZnJvbSAneWFyZ3MnO1xuaW1wb3J0IHJld3JpdGVSZXF1aXJlcyBmcm9tICcuLi9yZXdyaXRlUmVxdWlyZXMnO1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gcnVuKCkge1xuICBjb25zdCBpbnB1dCA9IHlhcmdzXG4gICAgLm9wdGlvbignZCcsIHtcbiAgICAgIGFsaWFzOiAnZGlyJyxcbiAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgcmVxdWlyZWQ6IHRydWUsXG4gICAgfSlcbiAgICAub3B0aW9uKCdoJywge1xuICAgICAgYWxpYXM6ICdoZWxwJyxcbiAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICB9KS5hcmd2IGFzIHtcbiAgICBkaXI/OiBzdHJpbmc7XG4gICAgaGVscD86IGJvb2xlYW47XG4gICAgXzogc3RyaW5nW107XG4gIH07XG5cbiAgaWYgKGlucHV0LmhlbHApIHtcbiAgICByZXR1cm4geWFyZ3Muc2hvd0hlbHAoKTtcbiAgfVxuXG4gIGF3YWl0IHJld3JpdGVSZXF1aXJlcyh7XG4gICAgZGlyOiBpbnB1dC5kaXIhLFxuICB9KTtcbn1cbiJdfQ==
run().catch((err) => {
console.error(chalk_1.default.red(`${chalk_1.default.bold('Error running command')}. Error: ${err.stack}`));
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZS1yZXF1aXJlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvcmV3cml0ZS1yZXF1aXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFFQSwwQkFBMEI7QUFDMUIsa0RBQTBCO0FBQzFCLGtEQUEwQjtBQUMxQix3REFBd0Q7QUFFeEQsS0FBSyxVQUFVLEdBQUc7SUFDaEIsTUFBTSxLQUFLLEdBQUcsZUFBSztTQUNoQixNQUFNLENBQUMsR0FBRyxFQUFFO1FBQ1gsS0FBSyx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c3RyaW5nJyxcbiAgICAgIHJlcXVpcmVkOiB0cnVlLFxuICAgIH0pXG4gICAgLm9wdGlvbignaCcsIHtcbiAgICAgIGFsaWFzOiAnaGVscCcsXG4gICAgICB0eXBlOiAnYm9vbGVhbicsXG4gICAgfSkuYXJndiBhcyB7XG4gICAgZGlyPzogc3RyaW5nO1xuICAgIGhlbHA/OiBib29sZWFuO1xuICAgIF86IHN0cmluZ1tdO1xuICB9O1xuXG4gIGlmIChpbnB1dC5oZWxwKSB7XG4gICAgcmV0dXJuIHlhcmdzLnNob3dIZWxwKCk7XG4gIH1cblxuICBhd2FpdCByZXdyaXRlUmVxdWlyZXMoe1xuICAgIGRpcjogaW5wdXQuZGlyISxcbiAgfSk7XG59XG5cbnJ1bigpLmNhdGNoKChlcnIpID0+IHtcbiAgY29uc29sZS5lcnJvcihcbiAgICBjaGFsay5yZWQoYCR7Y2hhbGsuYm9sZCgnRXJyb3IgcnVubmluZyBjb21tYW5kJyl9LiBFcnJvcjogJHtlcnIuc3RhY2t9YClcbiAgKTtcbn0pO1xuXCIuLi9yZXdyaXRlUmVxdWlyZXNcIiJdfQ==

@@ -1,3 +0,3 @@

import rewriteImports from './rewriteImports';
import rewriteRequires from './rewriteRequires';
import { rewriteImports } from './rewriteImports';
import { rewriteRequires } from './rewriteRequires';
export { rewriteImports, rewriteRequires };
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.rewriteRequires = exports.rewriteImports = void 0;
const rewriteImports_1 = __importDefault(require("./rewriteImports"));
exports.rewriteImports = rewriteImports_1.default;
const rewriteRequires_1 = __importDefault(require("./rewriteRequires"));
exports.rewriteRequires = rewriteRequires_1.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsc0VBQThDO0FBR3JDLHlCQUhGLHdCQUFjLENBR0U7QUFGdkIsd0VBQWdEO0FBRXZCLDBCQUZsQix5QkFBZSxDQUVrQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCByZXdyaXRlSW1wb3J0cyBmcm9tICcuL3Jld3JpdGVJbXBvcnRzJztcbmltcG9ydCByZXdyaXRlUmVxdWlyZXMgZnJvbSAnLi9yZXdyaXRlUmVxdWlyZXMnO1xuXG5leHBvcnQgeyByZXdyaXRlSW1wb3J0cywgcmV3cml0ZVJlcXVpcmVzIH07XG4iXX0=
const rewriteImports_1 = require("./rewriteImports");
Object.defineProperty(exports, "rewriteImports", { enumerable: true, get: function () { return rewriteImports_1.rewriteImports; } });
const rewriteRequires_1 = require("./rewriteRequires");
Object.defineProperty(exports, "rewriteRequires", { enumerable: true, get: function () { return rewriteRequires_1.rewriteRequires; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscURBQWtEO0FBR3pDLCtGQUhBLCtCQUFjLE9BR0E7QUFGdkIsdURBQW9EO0FBRTNCLGdHQUZoQixpQ0FBZSxPQUVnQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHJld3JpdGVJbXBvcnRzIH0gZnJvbSAnLi9yZXdyaXRlSW1wb3J0cyc7XG5pbXBvcnQgeyByZXdyaXRlUmVxdWlyZXMgfSBmcm9tICcuL3Jld3JpdGVSZXF1aXJlcyc7XG5cbmV4cG9ydCB7IHJld3JpdGVJbXBvcnRzLCByZXdyaXRlUmVxdWlyZXMgfTtcbiJdfQ==
{
"name": "@philidem/rewrite-relative-paths",
"version": "1.1.2",
"version": "1.2.0",
"description": "Tool for making import paths relative to project root and making require paths relative",

@@ -21,13 +21,14 @@ "keywords": [

"bin": {
"rewrite-imports": "./bin/rewrite-imports",
"rewrite-requires": "./bin/rewrite-requires"
"rewrite-imports": "node ./cli/rewrite-imports",
"rewrite-requires": "node ./cli/rewrite-requires"
},
"scripts": {
"precommit": "lint-staged",
"compile": "tsc -d -p tsconfig.dist.json",
"postinstall": "husky install || true",
"type-check": "tsc",
"compile": "ttsc -d -p tsconfig.dist.json",
"clean": "rm -rf ./dist",
"build": "yarn clean && yarn compile && cp -R package.json yarn.lock LICENSE README.md ./src/bin ./dist/src",
"build": "yarn clean && yarn compile && cp -R package.json yarn.lock LICENSE README.md ./dist/src",
"autobuild": "yarn build && (cd ./dist/src && yarn install --production && (yarn unlink || true) && yarn link) && yarn nodemon --exec 'yarn compile' --watch ./src -e ts",
"lint": "eslint --ext .ts,.tsx,.js,.jsx .",
"format-code": "prettier --write '**/*.{js,ts,md,json}'",
"format": "prettier --write '**/*.{js,ts,md,json}'",
"pretest": "rm -rf ./test/work && mkdir -p ./test/work && cp -R ./test/fixtures/fake-project ./test/work",

@@ -42,12 +43,13 @@ "test": "jest .",

"devDependencies": {
"@jupiterone/typescript-tools": "^13.2.1",
"nodemon": "^2.0.4"
"@jupiterone/typescript-tools": "^16.0.0",
"@types/node": "^14",
"nodemon": "^2.0.16"
},
"dependencies": {
"chalk": "^4.1.0",
"ignore": "^5.1.8",
"p-queue": "^6.6.2",
"walker": "^1.0.7",
"yargs": "^16.2.0"
"chalk": "^4",
"ignore": "^5.2.0",
"p-queue": "^6",
"walker": "^1.0.8",
"yargs": "^17.5.1"
}
}

@@ -1,2 +0,2 @@

export default function rewriteImports(options: {
export declare function rewriteImports(options: {
dir: string;

@@ -3,0 +3,0 @@ monorepo: boolean;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -6,7 +29,8 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.rewriteImports = void 0;
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = require("fs");
const p_queue_1 = __importDefault(require("p-queue"));
const fs_1 = require("fs");
const chalk_1 = __importDefault(require("chalk"));
const ignore_1 = __importDefault(require("ignore"));
const path_1 = require("path");
const path_1 = __importStar(require("path"));
const readIgnoreFiles_1 = require("./readIgnoreFiles");
const { readFile, writeFile } = fs_1.promises;

@@ -19,3 +43,3 @@ const Walker = require('walker');

return function (_, before, srcFile, after) {
const resolvedPath = '~/' + path_1.resolve(dir, srcFile).substring(1);
const resolvedPath = '~/' + (0, path_1.resolve)(dir, srcFile).substring(1);
return before + resolvedPath + after;

@@ -31,3 +55,3 @@ };

}
const dir = path_1.sep + path_1.dirname(srcFile);
const dir = path_1.sep + (0, path_1.dirname)(srcFile);
const oldContents = await readFile(file, { encoding: 'utf8' });

@@ -46,31 +70,17 @@ const newContents = oldContents

}
async function createIgnoreFilter() {
let fileContents;
try {
fileContents = await readFile('.gitignore', { encoding: 'utf8' });
}
catch (err) {
return {
isIgnored() {
return false;
},
};
}
const ignoreChecker = ignore_1.default().add(fileContents);
return {
isIgnored(file) {
return file !== '.' && ignoreChecker.ignores(file);
},
};
}
async function rewriteImports(options) {
var _a;
const rootDir = path_1.resolve(process.cwd(), options.dir);
const rootDir = (0, path_1.resolve)(process.cwd(), options.dir);
console.log(`Rewriting relative paths for files in ${chalk_1.default.bold(rootDir)} so that they use ~/* convention...`);
function handleFile(file) {
const filter = await (0, readIgnoreFiles_1.readIgnoreFiles)();
const handleFile = function (file) {
if (!file.endsWith('.ts') && !file.endsWith('.tsx')) {
return;
}
const relative = path_1.default.relative(rootDir, file);
if (relative && filter.isIgnored(relative)) {
return;
}
if (options.monorepo) {
const packagesDir = path_1.join(rootDir, 'packages');
const packagesDir = (0, path_1.join)(rootDir, 'packages');
if (file.startsWith(packagesDir + path_1.sep)) {

@@ -81,3 +91,3 @@ const relativeFile = file.substring(packagesDir.length + 1);

const packageName = relativeFile.substring(0, pos);
fixFile(path_1.join(packagesDir, packageName), file);
fixFile((0, path_1.join)(packagesDir, packageName), file);
}

@@ -89,3 +99,3 @@ }

}
}
};
if ((_a = options === null || options === void 0 ? void 0 : options.files) === null || _a === void 0 ? void 0 : _a.length) {

@@ -95,17 +105,8 @@ options.files.forEach(handleFile);

else {
const filter = await createIgnoreFilter();
const startDir = options.monorepo ? path_1.join(rootDir, 'packages') : rootDir;
const startDir = options.monorepo ? (0, path_1.join)(rootDir, 'packages') : rootDir;
await new Promise((resolve, reject) => {
Walker(startDir)
.filterDir(function (dir, stats) {
if (dir.startsWith(rootDir)) {
dir = dir.substring(rootDir.length);
}
if (dir.charAt(0) === path_1.sep) {
dir = dir.substring(1);
}
if (dir.length === 0) {
dir = '.';
}
return filter.isIgnored(dir) ? false : true;
const relative = path_1.default.relative(rootDir, dir);
return !relative || !filter.isIgnored(relative + '/');
})

@@ -121,3 +122,3 @@ .on('file', handleFile)

}
exports.default = rewriteImports;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZUltcG9ydHMuanMiLCJzb3VyY2VSb290IjoiIiwic291c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ICAgICAgICAgaWYgKGRpci5zdGFydHNXaXRoKHJvb3REaXIpKSB7XG4gICAgICAgICAgICBkaXIgPSBkaXIuc3Vic3RyaW5nKHJvb3REaXIubGVuZ3RoKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoZGlyLmNoYXJBdCgwKSA9PT0gc2VwKSB7XG4gICAgICAgICAgICBkaXIgPSBkaXIuc3Vic3RyaW5nKDEpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChkaXIubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICBkaXIgPSAnLic7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIGZpbHRlci5pc0lnbm9yZWQoZGlyKSA/IGZhbHNlIDogdHJ1ZTtcbiAgICAgICAgfSlcbiAgICAgICAgLm9uKCdmaWxlJywgaGFuZGxlRmlsZSlcbiAgICAgICAgLm9uKCdlbmQnLCBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgcmVzb2x2ZSh1bmRlZmluZWQpO1xuICAgICAgICB9KTtcbiAgICB9KTtcblxuICAgIGF3YWl0IHF1ZXVlLm9uSWRsZSgpO1xuICB9XG5cbiAgY29uc29sZS5sb2coY2hhbGsuZ3JlZW4oY2hhbGsuYm9sZCgnRG9uZSEnKSkpO1xufVxuIl19
exports.rewriteImports = rewriteImports;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZUltcG9ydHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcmV3cml0ZUltcG9ydHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxrREFBMEI7QUFDMUIsMkJBQWdEO0FBQ2hELHNEQUE2QjtBQUM3Qiw2Q0FBeUQ7QUFDekQsdURBQW9EO0FBRXBELE1BQU0sRUFBRSxRQUFRL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yk7XG4gICAgICAgIH0pXG4gICAgICAgIC5vbignZmlsZScsIGhhbmRsZUZpbGUpXG4gICAgICAgIC5vbignZW5kJywgZnVuY3Rpb24gKCkge1xuICAgICAgICAgIHJlc29sdmUodW5kZWZpbmVkKTtcbiAgICAgICAgfSk7XG4gICAgfSk7XG5cbiAgICBhd2FpdCBxdWV1ZS5vbklkbGUoKTtcbiAgfVxuXG4gIGNvbnNvbGUubG9nKGNoYWxrLmdyZWVuKGNoYWxrLmJvbGQoJ0RvbmUhJykpKTtcbn1cbiJdfQ==

@@ -1,3 +0,3 @@

export default function rewriteRequires(options: {
export declare function rewriteRequires(options: {
dir: string;
}): Promise<void>;

@@ -6,7 +6,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.rewriteRequires = void 0;
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = require("fs");
const p_queue_1 = __importDefault(require("p-queue"));
const fs_1 = require("fs");
const chalk_1 = __importDefault(require("chalk"));
const ignore_1 = __importDefault(require("ignore"));
const path_1 = __importDefault(require("path"));
const readIgnoreFiles_1 = require("./readIgnoreFiles");
const { readFile, writeFile } = fs_1.promises;

@@ -63,40 +64,17 @@ const Walker = require('walker');

}
async function createIgnoreFilter() {
let fileContents;
try {
fileContents = await readFile('.gitignore', { encoding: 'utf8' });
}
catch (err) {
return {
isIgnored() {
return false;
},
};
}
const ignoreChecker = ignore_1.default().add(fileContents);
return {
isIgnored(file) {
return file !== '.' && ignoreChecker.ignores(file);
},
};
}
async function rewriteRequires(options) {
const rootDir = path_1.default.resolve(process.cwd(), options.dir);
console.log(`Rewriting ~/* paths in ${chalk_1.default.bold(rootDir + '/**/*')} so that they are relative...`);
const filter = await createIgnoreFilter();
const filter = await (0, readIgnoreFiles_1.readIgnoreFiles)();
await new Promise((resolve, reject) => {
Walker(rootDir)
.filterDir(function (dir, stats) {
if (dir.startsWith(rootDir)) {
dir = dir.substring(rootDir.length);
}
if (dir.charAt(0) === '/') {
dir = dir.substring(1);
}
if (dir.length === 0) {
dir = '.';
}
return filter.isIgnored(dir) ? false : true;
const relative = path_1.default.relative(rootDir, dir);
return !relative || !filter.isIgnored(relative + '/');
})
.on('file', function (file, stats) {
const relative = path_1.default.relative(rootDir, file);
if (relative && filter.isIgnored(relative)) {
return;
}
if (file.endsWith('.js') ||

@@ -117,3 +95,3 @@ file.endsWith('.ts') ||

}
exports.default = rewriteRequires;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZVJlcXVpcmVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Jld3JpdGVSZXF1aXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNEQUE2QjtBQUM3QiwyQkFBNEM7QUFFNUMsa0RBQTBCO0FBQzFCLG9EQUE0QjtBQUM1QixnREFBd0I7QUFFeEIsTUFBTSxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsR0FBRyxhQUFVLENBQUM7QUFFM0MsTUFBTSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBRWpDLE1BQU0sS0FBSyxHQUFHLElBQUksaUJBQU0sQ0FBQyxFQUFFLFdBQVcsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRTdDLE1BQU0sbUJBQW1CLEdBQUcsNkJBQTZCLENBQUM7QUFDMUQsTUFBTSxtQkFBbUIsR0FBRyxpQ0FBaUMsQ0FBQztBQUM5RCxNQUFNLCtCQUErQixHQUFHLHFEQUFxRCxDQUFDO0FBQzlGLE1BQU0sd0JBQXdCLEdBQUcseUJBQXlCLENBQUM7QUFDM0QsTUFBTSx3QkFBd0IsR0FBRyx5QkFBeUIsQ0FBQztBQUUzRCxTQUFTLGNBQWMsQ0FBQyxPQUFlLEVBQUUsT0FBZTtJQUN0RCxPQUFPLFVBQ0wsQ0FBUyxFQUNULE1BQWMsRU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AgICAgICBmaWxlLmVuZHNXaXRoKCcuanMnKSB8fFxuICAgICAgICAgIGZpbGUuZW5kc1dpdGgoJy50cycpIHx8XG4gICAgICAgICAgZmlsZS5lbmRzV2l0aCgnLmpzeCcpIHx8XG4gICAgICAgICAgZmlsZS5lbmRzV2l0aCgnLnRzeCcpIHx8XG4gICAgICAgICAgZmlsZS5pbmRleE9mKCcuJykgPT09IC0xXG4gICAgICAgICkge1xuICAgICAgICAgIGZpeEZpbGUocm9vdERpciwgZmlsZSk7XG4gICAgICAgIH1cbiAgICAgIH0pXG4gICAgICAub24oJ2VuZCcsIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmVzb2x2ZSh1bmRlZmluZWQpO1xuICAgICAgfSk7XG4gIH0pO1xuXG4gIGF3YWl0IHF1ZXVlLm9uSWRsZSgpO1xuXG4gIGNvbnNvbGUubG9nKGNoYWxrLmdyZWVuKGNoYWxrLmJvbGQoJ0RvbmUhJykpKTtcbn1cbiJdfQ==
exports.rewriteRequires = rewriteRequires;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV3cml0ZVJlcXVpcmVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Jld3JpdGVSZXF1aXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxrREFBMEI7QUFDMUIsMkJBQWdEO0FBRWhELHNEQUE2QjtBQUM3QixnREFBd0I7QUFDeEIsdURBQW9EO0FBRXBELE1BQU0sRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLEdBQUcsYUFBVSxDQUFDO0FBRTNDLE1BQU0sTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUVqQyxNQUFNLEtBQUssR0FBRyxJQUFJLGlCQUFNLENBQUMsRUFBRSxXQUFXLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUU3Qy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XIsIGZpbGUpO1xuICAgICAgICBpZiAocmVsYXRpdmUgJiYgZmlsdGVyLmlzSWdub3JlZChyZWxhdGl2ZSkpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoXG4gICAgICAgICAgZmlsZS5lbmRzV2l0aCgnLmpzJykgfHxcbiAgICAgICAgICBmaWxlLmVuZHNXaXRoKCcudHMnKSB8fFxuICAgICAgICAgIGZpbGUuZW5kc1dpdGgoJy5qc3gnKSB8fFxuICAgICAgICAgIGZpbGUuZW5kc1dpdGgoJy50c3gnKSB8fFxuICAgICAgICAgIGZpbGUuaW5kZXhPZignLicpID09PSAtMVxuICAgICAgICApIHtcbiAgICAgICAgICBmaXhGaWxlKHJvb3REaXIsIGZpbGUpO1xuICAgICAgICB9XG4gICAgICB9KVxuICAgICAgLm9uKCdlbmQnLCBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJlc29sdmUodW5kZWZpbmVkKTtcbiAgICAgIH0pO1xuICB9KTtcblxuICBhd2FpdCBxdWV1ZS5vbklkbGUoKTtcblxuICBjb25zb2xlLmxvZyhjaGFsay5ncmVlbihjaGFsay5ib2xkKCdEb25lIScpKSk7XG59XG4iXX0=
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