initial commit - far from runnable

This commit is contained in:
Anika Raemer 2025-09-21 12:39:54 +02:00
commit db057ce342
8614 changed files with 1032171 additions and 0 deletions

21
node_modules/app-root-path/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Chris Morrell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

159
node_modules/app-root-path/README.md generated vendored Normal file
View file

@ -0,0 +1,159 @@
# App Root Path Module
[![Build Status][build-status-img]][build-status] [![Dependency Status][david-dm-img]][david-dm] [![Code Coverage Status][codecov-img]][codecov]
> **Please Note:** Due to the very limited scope of this module, I do not anticipate needing to make very many changes to it. Expect long stretches of zero updates—that does not mean that the module is outdated.
This simple module helps you access your application's root path from anywhere in the application without resorting to relative paths like `require("../../path")`.
## Installation
``` bash
$ npm i -S app-root-path
```
## Usage
To simply access the app's root path, use the module as though it were a string:
``` js
var appRoot = require('app-root-path');
var myModule = require(appRoot + '/lib/my-module.js');
```
> _Side note: the module actually returns an object, but that object implements the `toString` method, so you can use it as though it were a string. There are a few edge cases where this might not be the case (most notably `console.log`), but they shouldn't affect actual use of the module, where you're almost always concatenating with an additional string._
A helper function is also provided:
``` js
var reqlib = require('app-root-path').require;
var myModule = reqlib('/lib/my-module.js');
```
It's a little hacky, but you can also put this method on your application's `global` object to use it everywhere in your project:
``` js
// In app.js
global.reqlib = require('app-root-path').require;
// In lib/module/component/subcomponent.js
var myModule = reqlib('/lib/my-module.js');
```
Finally, you can also just resolve a module path:
``` js
var myModulePath = require('app-root-path').resolve('/lib/my-module.js');
```
You can explicitly set the path, using the environmental variable `APP_ROOT_PATH` or by calling `require('app-root-path').setPath('/my/app/is/here')`
## How It Works (under the hood)
> No need to read this unless you're curious—or you run into a (very unlikely) case where the module does not work as expected.
This module uses two different methods to determine the app's root path, depending on the circumstances.
### Primary Method
If the module is located inside your project's directory, somewhere within the `node_modules` directory (whether directly, or inside a submodule), we effectively do (the actual code takes cross-platform path names/etc into consideration):
``` js
path.resolve(__dirname).split('/node_modules')[0];
```
This will take a path like `/var/www/node_modules/submodule/node_modules/app-root-path` and return `/var/www`. In nearly all cases, this is just what you need.
### Secondary Method (for edge cases)
The node module loader will also look in a few other places for modules (for example, ones that you install globally with `npm install -g`). These can be in one of:
- `$HOME/.node_modules`
- `$HOME/.node_libraries`
- `$PREFIX/lib/node`
Or, anywhere in the `NODE_PATH` environmental variable ([see documentation](http://nodejs.org/api/modules.html#modules_loading_from_the_global_folders)).
In these cases, we fall back to an alternate trick:
``` js
path.dirname(require.main.filename);
```
When a file is run directly from Node, `require.main` is set to that file's `module`. Each module has a `filename` property that refers to the filename of that module, so by fetching the directory name for that file, we at least get the directory of file passed to `node`. In some cases (process managers and test suites, for example) this doesn't actually give the correct directory, though, so this method is only used as a fallback.
### Edge-Case: Global CLIs
If your module is installed as a global CLI, for example in `/usr/local/lib/node_modules/yourmodule`, then
`require.main.filename` will report `/usr/local/lib/node_modules/yourmodule/bin`, which is probably not what
you want. `app-root-path` is aware of this edge-case and will strip the `/bin` automatically.
## Change Log
### 3.1.0
- Added TypeScript types
- Added fallback for when `require.main` is missing (ESM imports)
### 3.0.0
- Improved Yarn Plug'n'Play support
- Fixed bug when used with webpack
### 2.2.1
- Better handling of webpack
### 2.2.0
- Added support for Yarn Plug'n'Play
- Adjusted browser-shim to address webpack warnings
- Bumped minimum Node version to 6
### 2.0.1
- Minor tweaks to how electron-specific logic runs. Should help with packagers that try to resolve all `require()` statements during packaging.
### 2.0.0
- Removed official support for node < 4.0
- Removed support for passing `module.require` to `appRootPath.require` (which has been deprecated for a while)
- Implemented [semantic-release](https://github.com/semantic-release/semantic-release) from here on out
- Added browserify-compatible shim
### 1.3.0
- Updated [electron](https://github.com/atom/electron) to match changes in version 1.0 of that project
### 1.2.1
- Had to bump package version because 1.2.0 got published to npm as @beta
### 1.2.0
- Special logic to resolve correctly when in an [electron](https://github.com/atom/electron) renderer process
### 1.1.0
- Special logic to handle an edge case when used in a globally-installed CLI project
- Fixed a bug where `setPath()` did not update `require('app-root-path').path`
- Moved some logic outside of the `resolve()` function so that it's not called multiple times
### 1.0.0
- No changes. Just updated the version to signify a locked API (see [semver](http://semver.org/)).
### 0.1.1
- Added Windows support (and, theoretically, other operating systems that have a directory separator that's not "/")
### 0.1.0
- Completely rewrote the path resolution method to account for most possible scenarios. This shouldn't cause and backwards compatibility issues, but always test your code.
- Removed the need to pass a modules's `require()` method to the `appRootPath.require()` function. Which it's true that each module has its own `require()` method, in practice it doesn't matter, and it's **much** simpler this way.
- Added tests
## Development Nodes
When using [semantic-release](https://github.com/semantic-release/semantic-release), the preferred method
for commits is:
- `git add …`
- `git cz` (see [commitizen](https://github.com/commitizen/cz-cli))
- `git push`
This helps ensure that commits match the expected format. Commits to `master` will cause releases.
[build-status]: https://travis-ci.org/inxilpro/node-app-root-path
[build-status-img]: https://travis-ci.org/inxilpro/node-app-root-path.svg
[david-dm-img]: https://david-dm.org/inxilpro/node-app-root-path.svg
[david-dm]: https://david-dm.org/inxilpro/node-app-root-path
[codecov-img]: https://codecov.io/gh/inxilpro/node-app-root-path/branch/master/graph/badge.svg
[codecov]: https://codecov.io/gh/inxilpro/node-app-root-path

22
node_modules/app-root-path/browser-shim.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
'use strict';
exports.path = require('path').dirname(require.main.filename);
exports.resolve = function(pathToModule) {
return exports.path + pathToModule;
};
exports.require = function(pathToModule) {
var r = 'function' === typeof __webpack_require__
? __non_webpack_require__
: require;
return r(exports.resolve(pathToModule));
};
exports.toString = function() {
return exports.path;
};
exports.setPath = function(explicitlySetPath) {
exports.path = explicitlySetPath;
};

8
node_modules/app-root-path/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,8 @@
declare namespace appRootPath {
export function resolve(pathToModule: string): string
export function require(pathToModule: string): ReturnType<NodeRequire>
export function toString(): string
export function setPath(explicitlySetPath: string): void
export const path: string
}
export = appRootPath

4
node_modules/app-root-path/index.js generated vendored Normal file
View file

@ -0,0 +1,4 @@
'use strict';
var lib = require('./lib/app-root-path.js');
module.exports = lib(__dirname);

30
node_modules/app-root-path/lib/app-root-path.js generated vendored Normal file
View file

@ -0,0 +1,30 @@
'use strict';
module.exports = function(dirname) {
var path = require('path');
var resolve = require('./resolve.js');
var appRootPath = resolve(dirname);
var publicInterface = {
resolve: function(pathToModule) {
return path.join(appRootPath, pathToModule);
},
require: function(pathToModule) {
return require(publicInterface.resolve(pathToModule));
},
toString: function() {
return appRootPath;
},
setPath: function(explicitlySetPath) {
appRootPath = path.resolve(explicitlySetPath);
publicInterface.path = appRootPath;
},
path: appRootPath
};
return publicInterface;
};

128
node_modules/app-root-path/lib/resolve.js generated vendored Normal file
View file

@ -0,0 +1,128 @@
'use strict';
// Dependencies
var path = require('path');
// Load global paths
var globalPaths = require('module').globalPaths;
// Guess at NPM's global install dir
var npmGlobalPrefix;
if ('win32' === process.platform) {
npmGlobalPrefix = path.dirname(process.execPath);
} else {
npmGlobalPrefix = path.dirname(path.dirname(process.execPath));
}
var npmGlobalModuleDir = path.resolve(npmGlobalPrefix, 'lib', 'node_modules');
// Save OS-specific path separator
var sep = path.sep;
// If we're in webpack, force it to use the original require() method
var requireFunction = ("function" === typeof __webpack_require__ || "function" === typeof __non_webpack_require__)
? __non_webpack_require__
: require;
const isInstalledWithPNPM = function(resolved) {
const pnpmDir = sep + '.pnpm';
for (const globalPath of globalPaths) {
if (-1 !== globalPath.indexOf(pnpmDir) && -1 !== resolved.indexOf(pnpmDir)) {
return true;
}
}
return false;
}
const getFirstPartFromNodeModules = function(resolved) {
const nodeModulesDir = sep + 'node_modules';
if (-1 !== resolved.indexOf(nodeModulesDir)) {
const parts = resolved.split(nodeModulesDir);
if (parts.length) {
return parts[0];
}
}
return null;
}
// Resolver
module.exports = function resolve(dirname) {
// Check for environmental variable
if (process.env.APP_ROOT_PATH) {
return path.resolve(process.env.APP_ROOT_PATH);
}
// Defer to Yarn Plug'n'Play if enabled
if (process.versions.pnp) {
try {
var pnp = requireFunction('pnpapi');
return pnp.getPackageInformation(pnp.topLevel).packageLocation;
} catch (e) {}
}
// Defer to main process in electron renderer
if ('undefined' !== typeof window && window.process && 'renderer' === window.process.type) {
try {
var remote = requireFunction('electron').remote;
return remote.require('app-root-path').path;
} catch (e) {}
}
// Defer to AWS Lambda when executing there
if (process.env.LAMBDA_TASK_ROOT && process.env.AWS_EXECUTION_ENV) {
return process.env.LAMBDA_TASK_ROOT;
}
var resolved = path.resolve(dirname);
var alternateMethod = false;
var appRootPath = null;
// Check if the globalPaths contain some folders with '.pnpm' in the path
// If yes this means it is most likely installed with pnpm
if (isInstalledWithPNPM(resolved)) {
appRootPath = getFirstPartFromNodeModules(resolved);
if (appRootPath) {
return appRootPath;
}
}
// Make sure that we're not loaded from a global include path
// Eg. $HOME/.node_modules
// $HOME/.node_libraries
// $PREFIX/lib/node
globalPaths.forEach(function(globalPath) {
if (!alternateMethod && 0 === resolved.indexOf(globalPath)) {
alternateMethod = true;
}
});
// If the app-root-path library isn't loaded globally,
// and node_modules exists in the path, just split __dirname
if (!alternateMethod) {
appRootPath = getFirstPartFromNodeModules(resolved);
}
// If the above didn't work, or this module is loaded globally, then
// resort to require.main.filename (See http://nodejs.org/api/modules.html)
if ((alternateMethod || null == appRootPath)) {
if (requireFunction.main) {
appRootPath = path.dirname(requireFunction.main.filename);
} else {
// This is the case when app-root-path is bundle'd to a commonjs2 format and is being called from an esm file.
// In those cases require.main is undefined (See https://nodejs.org/api/modules.html#accessing-the-main-module)
// At that point we can only get the root from looking at the callee
appRootPath = path.dirname(process.argv[1]);
}
}
// Handle global bin/ directory edge-case
if (alternateMethod && -1 !== appRootPath.indexOf(npmGlobalModuleDir) && (appRootPath.length - 4) === appRootPath.indexOf(sep + 'bin')) {
appRootPath = appRootPath.slice(0, -4);
}
// Return
return appRootPath;
};

66
node_modules/app-root-path/package.json generated vendored Normal file
View file

@ -0,0 +1,66 @@
{
"name": "app-root-path",
"version": "3.1.0",
"description": "Determine an app's root path from anywhere inside the app",
"main": "index.js",
"browser": "browser-shim.js",
"scripts": {
"test": "nyc mocha -R spec",
"report-coverage": "npm test && nyc report --reporter=text-lcov > coverage.lcov && codecov",
"release": "semantic-release pre && npm publish && semantic-release post",
"semantic-release": "semantic-release",
"commit": "npx git-cz"
},
"repository": {
"type": "git",
"url": "https://github.com/inxilpro/node-app-root-path.git"
},
"keywords": [
"root",
"path",
"utility",
"util",
"node",
"module",
"modules",
"node_modules",
"require",
"app"
],
"author": "Chris Morrell <http://cmorrell.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/inxilpro/node-app-root-path/issues"
},
"homepage": "https://github.com/inxilpro/node-app-root-path",
"devDependencies": {
"codecov": "^3.6.1",
"coveralls": "^3.0.7",
"cracks": "^3.1.2",
"cz-conventional-changelog": "^3.0.2",
"ghooks": "^2.0.4",
"istanbul": "^0.3.4",
"mocha": "^6.2.2",
"mocha-lcov-reporter": "0.0.1",
"mockery": "^1.7.0",
"nyc": "^14.1.1",
"semantic-release": "^15.13.28",
"validate-commit-msg": "^2.14.0"
},
"engines": {
"node": ">= 6.0.0"
},
"release": {
"branch": "master"
},
"config": {
"ghooks": {
"commit-msg": "validate-commit-msg",
"post-merge": "npm install",
"post-rewrite": "npm install"
},
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}