node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
/**
* Replaces backslashes with one forward slash
* @param input
*/
declare function forwardSlash(input: string): string;
export { forwardSlash };

View File

@@ -0,0 +1,15 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.forwardSlash = void 0;
const path_1 = __importDefault(require("path"));
/**
* Replaces backslashes with one forward slash
* @param input
*/
function forwardSlash(input) {
return path_1.default.normalize(input).replace(/\\+/g, '/');
}
exports.forwardSlash = forwardSlash;

View File

@@ -0,0 +1,2 @@
declare function isInsideAnotherPath(parent: string, directory: string): boolean;
export { isInsideAnotherPath };

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInsideAnotherPath = void 0;
const path_1 = require("path");
function isInsideAnotherPath(parent, directory) {
const relativePart = (0, path_1.relative)(parent, directory);
// Tested folder is above parent.
if (relativePart.startsWith('..')) {
return false;
}
// Tested folder is the same as parent.
if (relativePart.length === 0) {
return false;
}
// Tested directory has nothing in common with parent.
if ((0, path_1.isAbsolute)(relativePart)) {
return false;
}
// Last option, must be subfolder.
return true;
}
exports.isInsideAnotherPath = isInsideAnotherPath;

View File

@@ -0,0 +1,2 @@
declare function relativeToContext(file: string, context: string): string;
export { relativeToContext };

View File

@@ -0,0 +1,16 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.relativeToContext = void 0;
const path_1 = __importDefault(require("path"));
const forward_slash_1 = require("./forward-slash");
function relativeToContext(file, context) {
let fileInContext = (0, forward_slash_1.forwardSlash)(path_1.default.relative(context, file));
if (!fileInContext.startsWith('../')) {
fileInContext = './' + fileInContext;
}
return fileInContext;
}
exports.relativeToContext = relativeToContext;