Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

22
spa/node_modules/clean-webpack-plugin/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 John Agan
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.

161
spa/node_modules/clean-webpack-plugin/README.md generated vendored Normal file
View File

@@ -0,0 +1,161 @@
# Clean plugin for webpack
[![npm][npm-image]][npm-url]
[![MIT License][mit-license-image]][mit-license-url]
[![Linux Build Status][circleci-image]][circleci-url]
[![Windows Build Status][appveyor-image]][appveyor-url]
[![Coveralls Status][coveralls-image]][coveralls-url]
[npm-url]: https://www.npmjs.com/package/clean-webpack-plugin
[npm-image]: https://img.shields.io/npm/v/clean-webpack-plugin.svg?label=npm%20version
[mit-license-url]: LICENSE
[mit-license-image]: https://camo.githubusercontent.com/d59450139b6d354f15a2252a47b457bb2cc43828/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f7365727665726c6573732e737667
[circleci-url]: https://circleci.com/gh/johnagan/clean-webpack-plugin/tree/master
[circleci-image]: https://img.shields.io/circleci/project/github/johnagan/clean-webpack-plugin/master.svg?label=linux%20build
[appveyor-url]: https://ci.appveyor.com/project/johnagan/clean-webpack-plugin/branch/master
[appveyor-image]: https://img.shields.io/appveyor/ci/johnagan/clean-webpack-plugin/master.svg?label=windows%20build
[coveralls-url]: https://codecov.io/gh/johnagan/clean-webpack-plugin/branch/master
[coveralls-image]: https://img.shields.io/codecov/c/github/johnagan/clean-webpack-plugin/master.svg
A webpack plugin to remove/clean your build folder(s).
> NOTE: Node v10+ and webpack v4+ are supported and tested.
## About
By default, this plugin will remove all files inside webpack's `output.path` directory, as well as all unused webpack assets after every successful rebuild.
> Coming from `v1`? Please read about [additional v2 information](https://github.com/johnagan/clean-webpack-plugin/issues/106).
## Installation
`npm install --save-dev clean-webpack-plugin`
## Usage
```js
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const webpackConfig = {
plugins: [
/**
* All files inside webpack's output.path directory will be removed once, but the
* directory itself will not be. If using webpack 4+'s default configuration,
* everything under <PROJECT_DIR>/dist/ will be removed.
* Use cleanOnceBeforeBuildPatterns to override this behavior.
*
* During rebuilds, all webpack assets that are not used anymore
* will be removed automatically.
*
* See `Options and Defaults` for information
*/
new CleanWebpackPlugin(),
],
};
module.exports = webpackConfig;
```
## Options and Defaults (Optional)
```js
new CleanWebpackPlugin({
// Simulate the removal of files
//
// default: false
dry: true,
// Write Logs to Console
// (Always enabled when dry is true)
//
// default: false
verbose: true,
// Automatically remove all unused webpack assets on rebuild
//
// default: true
cleanStaleWebpackAssets: false,
// Do not allow removal of current webpack assets
//
// default: true
protectWebpackAssets: false,
// **WARNING**
//
// Notes for the below options:
//
// They are unsafe...so test initially with dry: true.
//
// Relative to webpack's output.path directory.
// If outside of webpack's output.path directory,
// use full path. path.join(process.cwd(), 'build/**/*')
//
// These options extend del's pattern matching API.
// See https://github.com/sindresorhus/del#patterns
// for pattern matching documentation
// Removes files once prior to Webpack compilation
// Not included in rebuilds (watch mode)
//
// Use !negative patterns to exclude files
//
// default: ['**/*']
cleanOnceBeforeBuildPatterns: [
'**/*',
'!static-files*',
'!directoryToExclude/**',
],
cleanOnceBeforeBuildPatterns: [], // disables cleanOnceBeforeBuildPatterns
// Removes files after every build (including watch mode) that match this pattern.
// Used for files that are not created directly by Webpack.
//
// Use !negative patterns to exclude files
//
// default: []
cleanAfterEveryBuildPatterns: ['static*.*', '!static1.js'],
// Allow clean patterns outside of process.cwd()
//
// requires dry option to be explicitly set
//
// default: false
dangerouslyAllowCleanPatternsOutsideProject: true,
});
```
## Example Webpack Config
This is a modified version of [WebPack's Plugin documentation](https://webpack.js.org/concepts/plugins/) that includes the Clean Plugin.
```js
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); // installed via npm
const HtmlWebpackPlugin = require('html-webpack-plugin'); // installed via npm
const webpack = require('webpack'); // to access built-in plugins
const path = require('path');
module.exports = {
entry: './path/to/my/entry/file.js',
output: {
/**
* With zero configuration,
* clean-webpack-plugin will remove files inside the directory below
*/
path: path.resolve(process.cwd(), 'dist'),
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
},
],
},
plugins: [
new webpack.ProgressPlugin(),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ template: './src/index.html' }),
],
};
```

View File

@@ -0,0 +1,80 @@
import { Compilation, Compiler, Stats } from 'webpack';
export interface Options {
/**
* Simulate the removal of files
*
* default: false
*/
dry?: boolean;
/**
* Write Logs to Console
* (Always enabled when dry is true)
*
* default: false
*/
verbose?: boolean;
/**
* Automatically remove all unused webpack assets on rebuild
*
* default: true
*/
cleanStaleWebpackAssets?: boolean;
/**
* Do not allow removal of current webpack assets
*
* default: true
*/
protectWebpackAssets?: boolean;
/**
* Removes files once prior to Webpack compilation
* Not included in rebuilds (watch mode)
*
* Use !negative patterns to exclude files
*
* default: ['**\/*']
*/
cleanOnceBeforeBuildPatterns?: string[];
/**
* Removes files after every build (including watch mode) that match this pattern.
* Used for files that are not created directly by Webpack.
*
* Use !negative patterns to exclude files
*
* default: []
*/
cleanAfterEveryBuildPatterns?: string[];
/**
* Allow clean patterns outside of process.cwd()
*
* requires dry option to be explicitly set
*
* default: false
*/
dangerouslyAllowCleanPatternsOutsideProject?: boolean;
}
declare class CleanWebpackPlugin {
private readonly dry;
private readonly verbose;
private readonly cleanStaleWebpackAssets;
private readonly protectWebpackAssets;
private readonly cleanAfterEveryBuildPatterns;
private readonly cleanOnceBeforeBuildPatterns;
private readonly dangerouslyAllowCleanPatternsOutsideProject;
private currentAssets;
private initialClean;
private outputPath;
constructor(options?: Options);
apply(compiler: Compiler): void;
/**
* Initially remove files from output directory prior to build.
*
* Only happens once.
*
* Warning: It is recommended to initially clean your build directory outside of webpack to minimize unexpected behavior.
*/
handleInitial(compilation: Compilation): void;
handleDone(stats: Stats): void;
removeFiles(patterns: string[]): void;
}
export { CleanWebpackPlugin };
//# sourceMappingURL=clean-webpack-plugin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"clean-webpack-plugin.d.ts","sourceRoot":"","sources":["../src/clean-webpack-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,WAAW,OAAO;IACpB;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,4BAA4B,CAAC,EAAE,MAAM,EAAE,CAAC;IAExC;;;;;;;OAOG;IACH,4BAA4B,CAAC,EAAE,MAAM,EAAE,CAAC;IAExC;;;;;;OAMG;IACH,2CAA2C,CAAC,EAAE,OAAO,CAAC;CACzD;AAYD,cAAM,kBAAkB;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAU;IAClD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAW;IACxD,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAW;IACxD,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAAU;IACtE,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,UAAU,CAAS;gBAEf,OAAO,GAAE,OAAY;IA8EjC,KAAK,CAAC,QAAQ,EAAE,QAAQ;IA+BxB;;;;;;OAMG;IACH,aAAa,CAAC,WAAW,EAAE,WAAW;IAoBtC,UAAU,CAAC,KAAK,EAAE,KAAK;IAyDvB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE;CA+CjC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}

View File

@@ -0,0 +1,223 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.CleanWebpackPlugin = void 0;
var _del = require("del");
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Copied from https://github.com/sindresorhus/is-plain-obj/blob/97480673cf12145b32ec2ee924980d66572e8a86/index.js
function isPlainObject(value) {
if (Object.prototype.toString.call(value) !== '[object Object]') {
return false;
}
const prototype = Object.getPrototypeOf(value);
return prototype === null || prototype === Object.getPrototypeOf({});
}
class CleanWebpackPlugin {
constructor(options = {}) {
if (isPlainObject(options) === false) {
throw new Error(`clean-webpack-plugin only accepts an options object. See:
https://github.com/johnagan/clean-webpack-plugin#options-and-defaults-optional`);
} // @ts-ignore
if (options.allowExternal) {
throw new Error('clean-webpack-plugin: `allowExternal` option no longer supported. Use `dangerouslyAllowCleanPatternsOutsideProject`');
}
if (options.dangerouslyAllowCleanPatternsOutsideProject === true && options.dry !== true && options.dry !== false) {
// eslint-disable-next-line no-console
console.warn('clean-webpack-plugin: dangerouslyAllowCleanPatternsOutsideProject requires dry: false to be explicitly set. Enabling dry mode');
}
this.dangerouslyAllowCleanPatternsOutsideProject = options.dangerouslyAllowCleanPatternsOutsideProject === true || false;
this.dry = options.dry === true || options.dry === false ? options.dry : this.dangerouslyAllowCleanPatternsOutsideProject === true || false;
this.verbose = this.dry === true || options.verbose === true || false;
this.cleanStaleWebpackAssets = options.cleanStaleWebpackAssets === true || options.cleanStaleWebpackAssets === false ? options.cleanStaleWebpackAssets : true;
this.protectWebpackAssets = options.protectWebpackAssets === true || options.protectWebpackAssets === false ? options.protectWebpackAssets : true;
this.cleanAfterEveryBuildPatterns = Array.isArray(options.cleanAfterEveryBuildPatterns) ? options.cleanAfterEveryBuildPatterns : [];
this.cleanOnceBeforeBuildPatterns = Array.isArray(options.cleanOnceBeforeBuildPatterns) ? options.cleanOnceBeforeBuildPatterns : ['**/*'];
/**
* Store webpack build assets
*/
this.currentAssets = [];
/**
* Only used with cleanOnceBeforeBuildPatterns
*/
this.initialClean = false;
this.outputPath = '';
this.apply = this.apply.bind(this);
this.handleInitial = this.handleInitial.bind(this);
this.handleDone = this.handleDone.bind(this);
this.removeFiles = this.removeFiles.bind(this);
}
apply(compiler) {
if (!compiler.options.output || !compiler.options.output.path) {
// eslint-disable-next-line no-console
console.warn('clean-webpack-plugin: options.output.path not defined. Plugin disabled...');
return;
}
this.outputPath = compiler.options.output.path;
/**
* webpack 4+ comes with a new plugin system.
*
* Check for hooks in-order to support old plugin system
* webpack 5+ removed the old system, the check now breaks
*/
const hooks = compiler.hooks;
if (this.cleanOnceBeforeBuildPatterns.length !== 0) {
hooks.emit.tap('clean-webpack-plugin', compilation => {
this.handleInitial(compilation);
});
}
hooks.done.tap('clean-webpack-plugin', stats => {
this.handleDone(stats);
});
}
/**
* Initially remove files from output directory prior to build.
*
* Only happens once.
*
* Warning: It is recommended to initially clean your build directory outside of webpack to minimize unexpected behavior.
*/
handleInitial(compilation) {
if (this.initialClean) {
return;
}
/**
* Do not remove files if there are compilation errors
*
* Handle logging inside this.handleDone
*/
const stats = compilation.getStats();
if (stats.hasErrors()) {
return;
}
this.initialClean = true;
this.removeFiles(this.cleanOnceBeforeBuildPatterns);
}
handleDone(stats) {
/**
* Do nothing if there is a webpack error
*/
if (stats.hasErrors()) {
if (this.verbose) {
// eslint-disable-next-line no-console
console.warn('clean-webpack-plugin: pausing due to webpack errors');
}
return;
}
/**
* Fetch Webpack's output asset files
*/
const assetList = Object.keys(stats.compilation.assets);
/**
* Get all files that were in the previous build but not the current
*
* (relies on del's cwd: outputPath option)
*/
const staleFiles = this.currentAssets.filter(previousAsset => {
const assetCurrent = assetList.includes(previousAsset) === false;
return assetCurrent;
});
/**
* Save assets for next compilation
*/
this.currentAssets = assetList.sort();
const removePatterns = [];
/**
* Remove unused webpack assets
*/
if (this.cleanStaleWebpackAssets === true && staleFiles.length !== 0) {
removePatterns.push(...staleFiles);
}
/**
* Remove cleanAfterEveryBuildPatterns
*/
if (this.cleanAfterEveryBuildPatterns.length !== 0) {
removePatterns.push(...this.cleanAfterEveryBuildPatterns);
}
if (removePatterns.length !== 0) {
this.removeFiles(removePatterns);
}
}
removeFiles(patterns) {
try {
const deleted = (0, _del.sync)(patterns, {
force: this.dangerouslyAllowCleanPatternsOutsideProject,
// Change context to build directory
cwd: this.outputPath,
dryRun: this.dry,
dot: true,
ignore: this.protectWebpackAssets ? this.currentAssets : []
});
/**
* Log if verbose is enabled
*/
if (this.verbose) {
deleted.forEach(file => {
const filename = _path.default.relative(process.cwd(), file);
const message = this.dry ? 'dry' : 'removed';
/**
* Use console.warn over .log
* https://github.com/webpack/webpack/issues/1904
* https://github.com/johnagan/clean-webpack-plugin/issues/11
*/
// eslint-disable-next-line no-console
console.warn(`clean-webpack-plugin: ${message} ${filename}`);
});
}
} catch (error) {
const needsForce = /Cannot delete files\/folders outside the current working directory\./.test(error.message);
if (needsForce) {
const message = 'clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.';
throw new Error(message);
}
/* istanbul ignore next */
throw error;
}
}
}
exports.CleanWebpackPlugin = CleanWebpackPlugin;
//# sourceMappingURL=clean-webpack-plugin.js.map

File diff suppressed because one or more lines are too long

82
spa/node_modules/clean-webpack-plugin/package.json generated vendored Normal file
View File

@@ -0,0 +1,82 @@
{
"name": "clean-webpack-plugin",
"version": "4.0.0",
"author": "John Agan <johnagan@gmail.com>",
"description": "A webpack plugin to remove/clean your build folder(s).",
"homepage": "https://github.com/johnagan/clean-webpack-plugin",
"license": "MIT",
"main": "dist/clean-webpack-plugin.js",
"types": "dist/clean-webpack-plugin.d.ts",
"files": [
"dist/"
],
"engines": {
"node": ">=10.0.0"
},
"keywords": [
"webpack",
"plugin",
"clean",
"node"
],
"repository": {
"type": "git",
"url": "https://github.com/johnagan/clean-webpack-plugin.git"
},
"bugs": {
"url": "https://github.com/johnagan/clean-webpack-plugin/issues"
},
"scripts": {
"clean": "del-cli --dot=true \"./dist/**/*\"",
"build": "npm run clean && npm run build.compile && npm run build.types",
"build.compile": "cross-env NODE_ENV=production babel src -d dist --verbose --extensions .ts --ignore */**/*.d.ts,**/**/*.test.ts --source-maps",
"build.types": "cross-env NODE_ENV=production tsc --project tsconfig.types.json",
"dev": "npm run clean && cross-env NODE_ENV=development babel -w src -d dist --verbose --extensions .ts --ignore */**/*.d.ts,**/**/*.test.ts --source-maps",
"lint": "eslint --ext .js,.ts .",
"lint.fix": "eslint --ext .js,.ts --fix .",
"format": "prettier \"**/*.{js,mjs,jsx,ts,tsx,json,scss,less,css,md,yml,yaml}\" --write",
"test": "jest",
"test.update": "jest --update-snapshot",
"test.watch": "jest --watch",
"test.all": "node ./dev-utils/test-supported-webpack-versions.js",
"test.ci": "npm run build && npm run lint && npm run typescript && npm run test.all -- --ci",
"typescript": "tsc",
"git-pre-commit": "lint-staged",
"git-pre-push": "npm run lint && npm run typescript && npm run test.all",
"prepublishOnly": "npm run build && npm run lint && npm run typescript && npm run test.all",
"release": "np"
},
"peerDependencies": {
"webpack": ">=4.0.0 <6.0.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-typescript": "^7.3.3",
"@chrisblossom/eslint-config": "^5.0.0",
"@types/jest": "^24.0.13",
"@types/node": "^12.0.2",
"@types/read-pkg-up": "^3.0.1",
"babel-jest": "^24.8.0",
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"del-cli": "^1.1.0",
"eslint": "^5.16.0",
"execa": "^1.0.0",
"husky": "^2.3.0",
"jest": "^24.8.0",
"lint-staged": "^8.1.7",
"listr": "^0.14.3",
"np": "^5.0.2",
"prettier": "^1.17.1",
"read-pkg-up": "^6.0.0",
"semver": "^6.0.0",
"temp-sandbox": "^3.0.0",
"typescript": "^3.4.5",
"webpack": "^5.31.2"
},
"dependencies": {
"del": "^4.1.1"
}
}