builderman verion 0.1.0, initial commit/release.

This commit is contained in:
2025-05-19 23:05:15 -04:00
parent 0578647c3f
commit ec0ffccdb2
1281 changed files with 218046 additions and 0 deletions

1079
node_modules/minify/ChangeLog generated vendored Normal file

File diff suppressed because it is too large Load Diff

114
node_modules/minify/HELP.md generated vendored Normal file
View File

@@ -0,0 +1,114 @@
Minify
===============
[NPM_INFO_IMG]: https://nodei.co/npm/minify.png?stars
[Minify](http://coderaiser.github.io/minify "Minify") - a minifier of js, css, html and img files,
used in [Cloud Commander](http://cloudcmd.io "Cloud Commander") project.
To use `minify` as middleware try [Mollify](https://github.com/coderaiser/node-mollify "Mollify").
Install
---------------
![NPM_INFO][NPM_INFO_IMG]
You can install minify via [npm](https://www.npmjs.org/):
```
npm i minify -g
```
Command Line
---------------
Command line syntax:
```
minify <input-file1> <input-file2> <input-fileN> > output
stdout | minify --<flag>
```
For example:
```
minify client.js util.js > all.js
minify screen.css reset.css > all.css
cat client.js | minify --js
cat *.css | minify --css
```
API
---------------
The **Minify** module contains an api for interacting with other js files.
```js
minify = require('minify');
```
After minification, a file will be saved in the temporary directory.
minify - function to minificate js, html and css-files.
- **file** - path to file.
- **options**(optional) - object contains options.
- **callback**
Possible options:
- **name**
- **stream**
**Examples**:
## Optimize file
```js
var minify = require('minify');
minify('client.js', 'name', function(error, name) {
console.log(error || name);
});
```
```js
minify('client.js', 'stream', function(error, stream) {
var streamWrite = fs.createWriteStream('client.min.js');
if (error)
console.error(error.message);
else
stream.pipe(streamWrite);
});
```
if post processing is need:
```js
minify('client.js', function(error, data) {
});
```
## Optimize data
Parameters:
- Data
- Callback
**Example**:
```js
minify.js('function hello() { if (2 > 3) console.log(\'for real\')}', function(error, data) {
console.log(error, data);
});
minify.css('div { color: #000000}', function(error, data) {
console.log(error, data);
});
```
## Express middleware
To use as express middleware [mollify](https://github.com/coderaiser/node-mollify Mollify) could be used.
License
---------------
MIT

22
node_modules/minify/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2012-2019 Coderaiser <mnemonic.enemy@gmail.com>
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.

141
node_modules/minify/README.md generated vendored Normal file
View File

@@ -0,0 +1,141 @@
Minify [![License][LicenseIMGURL]][LicenseURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![NPM version][NPMIMGURL]][NPMURL]
===============
[NPMIMGURL]: https://img.shields.io/npm/v/minify.svg?style=flat
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/minify/master.svg?style=flat
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/minify.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPM_INFO_IMG]: https://nodei.co/npm/minify.png?stars
[NPMURL]: http://npmjs.org/package/minify
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[BuildStatusURL]: http://travis-ci.org/coderaiser/minify "Build Status"
[DependencyStatusURL]: https://david-dm.org/coderaiser/minify "Dependency Status"
[Minify](http://coderaiser.github.io/minify "Minify") - a minifier of js, css, html and img files.
To use `minify` as middleware try [Mollify](https://github.com/coderaiser/node-mollify "Mollify").
## Install
```
npm i minify -g
```
## How to use?
### CLI
The bash command below creates a code snippet saved as "hello.js".
Simply copy + paste the code starting with cat, including the EOT on the last line, and press <enter>.
```js
$ cat << EOT > hello.js
const hello = 'world';
for (let i = 0; i < hello.length; i++) {
console.log(hello[i]);
}
EOT
```
Use the command `minify` followed by the path to and name of the js file intended to be minified. This will minify the code and output it to the screen.
```js
$ minify hello.js
const hello="world";for(let l=0;l<hello.length;l++)console.log(hello[l]);
```
You can capture the output with the following:
```js
$ minify hello.js > hello.min.js
```
### Code Example
`minify` can be used as a `promise`:
```js
const minify = require('minify');
const options = {
html: {
removeAttributeQuotes: false,
removeOptionalTags: false
},
};
minify('./client.js', options)
.then(console.log)
.catch(console.error);
```
Or with `async-await` and [try-to-catch](https://github.com/coderaiser/try-to-catch):
```js
const minify = require('minify');
const tryToCatch = require('try-to-catch');
const options = {
html: {
removeAttributeQuotes: false,
removeOptionalTags: false
}
};
async () => {
const [error, data] = await tryToCatch(minify, './client.js', options);
if (error)
return console.error(error.message);
console.log(data);
}();
```
## Options
The options object accepts configuration for `html`, `css`, `js`, and `img` like so:
```js
const options = {
html: {
removeAttributeQuotes: false,
},
css: {
compatibility: '*',
},
js: {
ecma: 5,
},
img: {
maxSize: 4096,
}
}
```
Full documentation for options that each file type accepts can be found on the pages of the libraries used by minify to process the files:
- HTML: https://github.com/kangax/html-minifier
- CSS: https://github.com/jakubpawlowicz/clean-css
- JS: https://github.com/terser/terser
- IMG: https://github.com/Filirom1/css-base64-images
Minify sets a few defaults for HTML that may differ from the base `html-minifier` settings:
- removeComments: true
- removeCommentsFromCDATA: true
- removeCDATASectionsFromCDATA: true
- collapseWhitespace: true
- collapseBooleanAttributes: true
- removeAttributeQuotes: true
- removeRedundantAttributes: true
- useShortDoctype: true
- removeEmptyAttributes: true
- removeEmptyElements: false
- removeOptionalTags: true
- removeScriptTypeAttributes: true
- removeStyleLinkTypeAttributes: true
- minifyJS: true
- minifyCSS: true
## License
MIT

101
node_modules/minify/bin/minify.js generated vendored Executable file
View File

@@ -0,0 +1,101 @@
#!/usr/bin/env node
'use strict';
const Pack = require('../package');
const Version = Pack.version;
const log = function(...args) {
console.log(...args);
process.stdin.pause();
};
const Argv = process.argv;
const files = Argv.slice(2);
const [In] = files;
log.error = (e) => {
console.error(e);
process.stdin.pause();
};
process.on('uncaughtException', (error) => {
if (error.code !== 'EPIPE')
log(error);
});
minify();
function readStd(callback) {
const {stdin} = process;
let chunks = '';
const read = () => {
const chunk = stdin.read();
if (chunk)
return chunks += chunk;
stdin.removeListener('readable', read);
callback(chunks);
};
stdin.setEncoding('utf8');
stdin.addListener('readable', read);
}
function minify() {
if (!In || /^(-h|--help)$/.test(In))
return help();
if (/^--(js|css|html)$/.test(In))
return readStd(processStream);
if (/^(-v|--version)$/.test(In))
return log('v' + Version);
uglifyFiles(files);
}
async function processStream(chunks) {
const minify = require('..');
const tryToCatch = require('try-to-catch');
if (!chunks || !In)
return;
const name = In.replace('--', '');
const [e, data] = await tryToCatch(minify[name], chunks);
if (e)
return log.error(e);
log(data);
}
function uglifyFiles(files) {
const minify = require('..');
const minifiers = files.map(minify);
Promise.all(minifiers)
.then(logAll)
.catch(log.error);
}
function logAll(array) {
for (const item of array)
log(item);
}
function help() {
const bin = require('../help');
const usage = 'Usage: minify [options]';
console.log(usage);
console.log('Options:');
for (const name of Object.keys(bin)) {
console.log(' %s %s', name, bin[name]);
}
}

7
node_modules/minify/help.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"-h, --help ": "display this help and exit",
"-v, --version ": "display version and exit",
"--js ": "minify javascript",
"--css ": "minify css",
"--html ": "minify html"
}

31
node_modules/minify/lib/css.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
/* сжимаем код через clean-css */
'use strict';
const assert = require('assert');
const Clean = require('clean-css');
/**
* minify css data.
*
* @param data
* @param userOptions - (optional) object that may contain a `css` key with an object of options
*/
module.exports = (data, userOptions) => {
assert(data);
const options = userOptions && userOptions.css || {};
const {
styles,
errors,
} = new Clean(options).minify(data);
const [error] = errors;
if (error)
throw error;
return styles;
};

47
node_modules/minify/lib/html.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
/* сжимаем код через htmlMinify */
'use strict';
const assert = require('assert');
const Minifier = require('html-minifier-terser');
const defaultOptions = {
removeComments: true,
removeCommentsFromCDATA: true,
removeCDATASectionsFromCDATA: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
/* оставляем, поскольку у нас
* в элемент fm генерируеться
* таблица файлов
*/
removeEmptyElements: false,
removeOptionalTags: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
minifyJS: true,
minifyCSS: true,
};
/**
* minify html data.
*
* @param data
* @param userOptions - (optional) object that may contain an `html` key with an object of options
*/
module.exports = (data, userOptions) => {
assert(data);
const options = {
...defaultOptions,
...userOptions && userOptions.html || {},
};
return Minifier.minify(data, options);
};

37
node_modules/minify/lib/img.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
'use strict';
const path = require('path');
const assert = require('assert');
const {promisify} = require('util');
const fromString = promisify(require('css-b64-images').fromString);
const ONE_KB = 2 ** 10;
const defaultOptions = {
maxSize: 100 * ONE_KB,
};
/**
* minify css data.
* if can not minify return data
*
* @param name
* @param data
* @param userOptions - (optional) object that may contain an `img` key with an object of options
*/
module.exports = async (name, data, userOptions) => {
const dir = path.dirname(name);
const dirRelative = dir + '/../';
const options = {
...defaultOptions,
...userOptions && userOptions.img || {},
};
assert(name);
assert(data);
return fromString(data, dir, dirRelative, options);
};

20
node_modules/minify/lib/js.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
'use strict';
const terser = require('terser');
const assert = require('assert');
/**
* minify js data.
*
* @param data
* @param userOptions - (optional) object that may contain a `js` key with an object of options
*/
module.exports = async (data, userOptions) => {
assert(data);
const options = userOptions && userOptions.js || {};
const {code} = await terser.minify(data, options);
return code;
};

84
node_modules/minify/lib/minify.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
'use strict';
const DIR = __dirname + '/';
const {readFile} = require('fs').promises;
const path = require('path');
const tryToCatch = require('try-to-catch');
const log = require('debug')('minify');
for (const name of ['js', 'html', 'css', 'img']) {
minify[name] = require(DIR + name);
}
module.exports = minify;
function check(name) {
if (!name)
throw Error('name could not be empty!');
}
async function minify(name, userOptions) {
const EXT = ['js', 'html', 'css'];
check(name);
const ext = path.extname(name).slice(1);
const is = EXT.includes(ext);
if (!is)
throw Error(`File type "${ext}" not supported.`);
log('optimizing ' + path.basename(name));
return await optimize(name, userOptions);
}
function getName(file) {
const notObj = typeof file !== 'object';
if (notObj)
return file;
return Object.keys(file)[0];
}
/**
* function minificate js,css and html files
*
* @param {string} file - js, css or html file path
* @param {object} userOptions - object with optional `html`, `css, `js`, and `img` keys, which each can contain options to be combined with defaults and passed to the respective minifier
*/
async function optimize(file, userOptions) {
check(file);
const name = getName(file);
log('reading file ' + path.basename(name));
const data = await readFile(name, 'utf8');
return await onDataRead(file, data, userOptions);
}
/**
* Processing of files
* @param {string} filename
* @param {string} data - the contents of the file
* @param {object} userOptions - object with optional `html`, `css, `js`, and `img` keys, which each can contain options to be combined with defaults and passed to the respective minifier
*/
async function onDataRead(filename, data, userOptions) {
log('file ' + path.basename(filename) + ' read');
const ext = path.extname(filename).replace(/^\./, '');
const optimizedData = await minify[ext](data, userOptions);
let b64Optimize;
if (ext === 'css')
[, b64Optimize] = await tryToCatch(minify.img, filename, optimizedData, userOptions);
return b64Optimize || optimizedData;
}

66
node_modules/minify/package.json generated vendored Normal file
View File

@@ -0,0 +1,66 @@
{
"name": "minify",
"version": "6.0.1",
"description": "Minifier of js, css, html and img",
"homepage": "http://coderaiser.github.io/minify",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
"keywords": [
"minify",
"minimize",
"js",
"css",
"img",
"html",
"base64"
],
"repository": {
"type": "git",
"url": "http://github.com/coderaiser/minify.git"
},
"bin": {
"minify": "bin/minify.js"
},
"nyc": {
"exclude": [
"**/*.spec.js",
".*",
"test"
]
},
"scripts": {
"test": "madrun test",
"coverage": "madrun coverage",
"report": "madrun report",
"lint": "madrun lint",
"fix:lint": "madrun fix:lint",
"lint:bin": "madrun lint:bin",
"lint:lib": "madrun lint:lib",
"putout": "madrun putout"
},
"dependencies": {
"clean-css": "^4.1.6",
"css-b64-images": "~0.2.5",
"debug": "^4.1.0",
"html-minifier-terser": "^5.1.1",
"terser": "^5.3.2",
"try-to-catch": "^3.0.0"
},
"main": "lib/minify.js",
"license": "MIT",
"engines": {
"node": ">=12"
},
"devDependencies": {
"coveralls": "^3.0.0",
"eslint": "^7.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-putout": "^5.1.1",
"madrun": "^7.0.4",
"nyc": "^15.0.0",
"putout": "^10.0.1",
"supertape": "^2.0.1"
},
"publishConfig": {
"access": "public"
}
}