Add node modules and compiled JavaScript from main

This commit is contained in:
Oliver King 2022-06-21 13:37:16 +00:00
parent d893f27da9
commit 4b42a5ec78
6750 changed files with 1745644 additions and 10860 deletions

10
node_modules/get-package-type/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## 0.1.0 (2020-05-19)
### Features
* Initial implementation ([52863f4](https://github.com/cfware/get-package-type/commit/52863f4b2b7b287fe1adcd97331231a2911312dc))

21
node_modules/get-package-type/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 CFWare, LLC
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.

32
node_modules/get-package-type/README.md generated vendored Normal file
View file

@ -0,0 +1,32 @@
# get-package-type [![NPM Version][npm-image]][npm-url]
Determine the `package.json#type` which applies to a location.
## Usage
```js
const getPackageType = require('get-package-type');
(async () => {
console.log(await getPackageType('file.js'));
console.log(getPackageType.sync('file.js'));
})();
```
This function does not validate the value found in `package.json#type`. Any truthy value
found will be returned. Non-truthy values will be reported as `commonjs`.
The argument must be a filename.
```js
// This never looks at `dir1/`, first attempts to load `./package.json`.
const type1 = await getPackageType('dir1/');
// This attempts to load `dir1/package.json`.
const type2 = await getPackageType('dir1/index.cjs');
```
The extension of the filename does not effect the result. The primary use case for this
module is to determine if `myapp.config.js` should be loaded with `require` or `import`.
[npm-image]: https://img.shields.io/npm/v/get-package-type.svg
[npm-url]: https://npmjs.org/package/get-package-type

52
node_modules/get-package-type/async.cjs generated vendored Normal file
View file

@ -0,0 +1,52 @@
'use strict';
const path = require('path');
const {promisify} = require('util');
const readFile = promisify(require('fs').readFile);
const isNodeModules = require('./is-node-modules.cjs');
const resultsCache = require('./cache.cjs');
const promiseCache = new Map();
async function getDirectoryTypeActual(directory) {
if (isNodeModules(directory)) {
return 'commonjs';
}
try {
return JSON.parse(await readFile(path.resolve(directory, 'package.json'))).type || 'commonjs';
} catch (_) {
}
const parent = path.dirname(directory);
if (parent === directory) {
return 'commonjs';
}
return getDirectoryType(parent);
}
async function getDirectoryType(directory) {
if (resultsCache.has(directory)) {
return resultsCache.get(directory);
}
if (promiseCache.has(directory)) {
return promiseCache.get(directory);
}
const promise = getDirectoryTypeActual(directory);
promiseCache.set(directory, promise);
const result = await promise;
resultsCache.set(directory, result);
promiseCache.delete(directory);
return result;
}
function getPackageType(filename) {
return getDirectoryType(path.resolve(path.dirname(filename)));
}
module.exports = getPackageType;

3
node_modules/get-package-type/cache.cjs generated vendored Normal file
View file

@ -0,0 +1,3 @@
'use strict';
module.exports = new Map();

7
node_modules/get-package-type/index.cjs generated vendored Normal file
View file

@ -0,0 +1,7 @@
'use strict';
const getPackageType = require('./async.cjs');
const getPackageTypeSync = require('./sync.cjs');
module.exports = filename => getPackageType(filename);
module.exports.sync = getPackageTypeSync;

15
node_modules/get-package-type/is-node-modules.cjs generated vendored Normal file
View file

@ -0,0 +1,15 @@
'use strict';
const path = require('path');
function isNodeModules(directory) {
let basename = path.basename(directory);
/* istanbul ignore next: platform specific branch */
if (path.sep === '\\') {
basename = basename.toLowerCase();
}
return basename === 'node_modules';
}
module.exports = isNodeModules;

35
node_modules/get-package-type/package.json generated vendored Normal file
View file

@ -0,0 +1,35 @@
{
"name": "get-package-type",
"version": "0.1.0",
"description": "Determine the `package.json#type` which applies to a location",
"type": "module",
"main": "index.cjs",
"exports": "./index.cjs",
"scripts": {
"pretest": "if-ver -ge 10 || exit 0; cfware-lint .",
"tests-only": "nyc -s node test.cjs",
"test": "npm run -s tests-only",
"posttest": "nyc report --check-coverage"
},
"engines": {
"node": ">=8.0.0"
},
"author": "Corey Farrell",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/cfware/get-package-type.git"
},
"bugs": {
"url": "https://github.com/cfware/get-package-type/issues"
},
"homepage": "https://github.com/cfware/get-package-type#readme",
"dependencies": {},
"devDependencies": {
"@cfware/lint": "^1.4.3",
"@cfware/nyc": "^0.7.0",
"if-ver": "^1.1.0",
"libtap": "^0.3.0",
"nyc": "^15.0.1"
}
}

42
node_modules/get-package-type/sync.cjs generated vendored Normal file
View file

@ -0,0 +1,42 @@
'use strict';
const path = require('path');
const {readFileSync} = require('fs');
const isNodeModules = require('./is-node-modules.cjs');
const resultsCache = require('./cache.cjs');
function getDirectoryTypeActual(directory) {
if (isNodeModules(directory)) {
return 'commonjs';
}
try {
return JSON.parse(readFileSync(path.resolve(directory, 'package.json'))).type || 'commonjs';
} catch (_) {
}
const parent = path.dirname(directory);
if (parent === directory) {
return 'commonjs';
}
return getDirectoryType(parent);
}
function getDirectoryType(directory) {
if (resultsCache.has(directory)) {
return resultsCache.get(directory);
}
const result = getDirectoryTypeActual(directory);
resultsCache.set(directory, result);
return result;
}
function getPackageTypeSync(filename) {
return getDirectoryType(path.resolve(path.dirname(filename)));
}
module.exports = getPackageTypeSync;