feat: initial commit
This commit is contained in:
20
node_modules/css-loader/LICENSE
generated
vendored
Normal file
20
node_modules/css-loader/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright JS Foundation and other contributors
|
||||
|
||||
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.
|
1485
node_modules/css-loader/README.md
generated
vendored
Normal file
1485
node_modules/css-loader/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
40
node_modules/css-loader/dist/CssSyntaxError.js
generated
vendored
Normal file
40
node_modules/css-loader/dist/CssSyntaxError.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class CssSyntaxError extends Error {
|
||||
constructor(error) {
|
||||
super(error);
|
||||
const {
|
||||
reason,
|
||||
line,
|
||||
column,
|
||||
file
|
||||
} = error;
|
||||
this.name = "CssSyntaxError"; // Based on https://github.com/postcss/postcss/blob/master/lib/css-syntax-error.es6#L132
|
||||
// We don't need `plugin` and `file` properties.
|
||||
|
||||
this.message = `${this.name}\n\n`;
|
||||
|
||||
if (typeof line !== "undefined") {
|
||||
this.message += `(${line}:${column}) `;
|
||||
}
|
||||
|
||||
this.message += file ? `${file} ` : "<css input> ";
|
||||
this.message += `${reason}`;
|
||||
const code = error.showSourceCode();
|
||||
|
||||
if (code) {
|
||||
this.message += `\n\n${code}\n`;
|
||||
} // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror
|
||||
|
||||
|
||||
this.stack = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = CssSyntaxError;
|
32
node_modules/css-loader/dist/Warning.js
generated
vendored
Normal file
32
node_modules/css-loader/dist/Warning.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class Warning extends Error {
|
||||
constructor(warning) {
|
||||
super(warning);
|
||||
const {
|
||||
text,
|
||||
line,
|
||||
column
|
||||
} = warning;
|
||||
this.name = "Warning"; // Based on https://github.com/postcss/postcss/blob/master/lib/warning.es6#L74
|
||||
// We don't need `plugin` properties.
|
||||
|
||||
this.message = `${this.name}\n\n`;
|
||||
|
||||
if (typeof line !== "undefined") {
|
||||
this.message += `(${line}:${column}) `;
|
||||
}
|
||||
|
||||
this.message += `${text}`; // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror
|
||||
|
||||
this.stack = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = Warning;
|
5
node_modules/css-loader/dist/cjs.js
generated
vendored
Normal file
5
node_modules/css-loader/dist/cjs.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const loader = require("./index");
|
||||
|
||||
module.exports = loader.default;
|
184
node_modules/css-loader/dist/index.js
generated
vendored
Normal file
184
node_modules/css-loader/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loader;
|
||||
|
||||
var _loaderUtils = require("loader-utils");
|
||||
|
||||
var _postcss = _interopRequireDefault(require("postcss"));
|
||||
|
||||
var _package = _interopRequireDefault(require("postcss/package.json"));
|
||||
|
||||
var _schemaUtils = require("schema-utils");
|
||||
|
||||
var _semver = require("semver");
|
||||
|
||||
var _CssSyntaxError = _interopRequireDefault(require("./CssSyntaxError"));
|
||||
|
||||
var _Warning = _interopRequireDefault(require("./Warning"));
|
||||
|
||||
var _options = _interopRequireDefault(require("./options.json"));
|
||||
|
||||
var _plugins = require("./plugins");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
async function loader(content, map, meta) {
|
||||
const rawOptions = (0, _loaderUtils.getOptions)(this);
|
||||
(0, _schemaUtils.validate)(_options.default, rawOptions, {
|
||||
name: "CSS Loader",
|
||||
baseDataPath: "options"
|
||||
});
|
||||
const plugins = [];
|
||||
const callback = this.async();
|
||||
let options;
|
||||
|
||||
try {
|
||||
options = (0, _utils.normalizeOptions)(rawOptions, this);
|
||||
} catch (error) {
|
||||
callback(error);
|
||||
return;
|
||||
}
|
||||
|
||||
const replacements = [];
|
||||
const exports = [];
|
||||
|
||||
if ((0, _utils.shouldUseModulesPlugins)(options)) {
|
||||
plugins.push(...(0, _utils.getModulesPlugins)(options, this));
|
||||
}
|
||||
|
||||
const importPluginImports = [];
|
||||
const importPluginApi = [];
|
||||
|
||||
if ((0, _utils.shouldUseImportPlugin)(options)) {
|
||||
const resolver = this.getResolve({
|
||||
conditionNames: ["style"],
|
||||
extensions: [".css"],
|
||||
mainFields: ["css", "style", "main", "..."],
|
||||
mainFiles: ["index", "..."]
|
||||
});
|
||||
plugins.push((0, _plugins.importParser)({
|
||||
imports: importPluginImports,
|
||||
api: importPluginApi,
|
||||
context: this.context,
|
||||
rootContext: this.rootContext,
|
||||
filter: (0, _utils.getFilter)(options.import, this.resourcePath),
|
||||
resolver,
|
||||
urlHandler: url => (0, _loaderUtils.stringifyRequest)(this, (0, _utils.combineRequests)((0, _utils.getPreRequester)(this)(options.importLoaders), url))
|
||||
}));
|
||||
}
|
||||
|
||||
const urlPluginImports = [];
|
||||
|
||||
if ((0, _utils.shouldUseURLPlugin)(options)) {
|
||||
const urlResolver = this.getResolve({
|
||||
conditionNames: ["asset"],
|
||||
mainFields: ["asset"],
|
||||
mainFiles: [],
|
||||
extensions: []
|
||||
});
|
||||
plugins.push((0, _plugins.urlParser)({
|
||||
imports: urlPluginImports,
|
||||
replacements,
|
||||
context: this.context,
|
||||
rootContext: this.rootContext,
|
||||
filter: (0, _utils.getFilter)(options.url, this.resourcePath),
|
||||
resolver: urlResolver,
|
||||
urlHandler: url => (0, _loaderUtils.stringifyRequest)(this, url)
|
||||
}));
|
||||
}
|
||||
|
||||
const icssPluginImports = [];
|
||||
const icssPluginApi = [];
|
||||
const needToUseIcssPlugin = (0, _utils.shouldUseIcssPlugin)(options);
|
||||
|
||||
if (needToUseIcssPlugin) {
|
||||
const icssResolver = this.getResolve({
|
||||
conditionNames: ["style"],
|
||||
extensions: [],
|
||||
mainFields: ["css", "style", "main", "..."],
|
||||
mainFiles: ["index", "..."]
|
||||
});
|
||||
plugins.push((0, _plugins.icssParser)({
|
||||
imports: icssPluginImports,
|
||||
api: icssPluginApi,
|
||||
replacements,
|
||||
exports,
|
||||
context: this.context,
|
||||
rootContext: this.rootContext,
|
||||
resolver: icssResolver,
|
||||
urlHandler: url => (0, _loaderUtils.stringifyRequest)(this, (0, _utils.combineRequests)((0, _utils.getPreRequester)(this)(options.importLoaders), url))
|
||||
}));
|
||||
} // Reuse CSS AST (PostCSS AST e.g 'postcss-loader') to avoid reparsing
|
||||
|
||||
|
||||
if (meta) {
|
||||
const {
|
||||
ast
|
||||
} = meta;
|
||||
|
||||
if (ast && ast.type === "postcss" && (0, _semver.satisfies)(ast.version, `^${_package.default.version}`)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
content = ast.root;
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
resourcePath
|
||||
} = this;
|
||||
let result;
|
||||
|
||||
try {
|
||||
result = await (0, _postcss.default)(plugins).process(content, {
|
||||
hideNothingWarning: true,
|
||||
from: resourcePath,
|
||||
to: resourcePath,
|
||||
map: options.sourceMap ? {
|
||||
prev: map ? (0, _utils.normalizeSourceMap)(map, resourcePath) : null,
|
||||
inline: false,
|
||||
annotation: false
|
||||
} : false
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.file) {
|
||||
this.addDependency(error.file);
|
||||
}
|
||||
|
||||
callback(error.name === "CssSyntaxError" ? new _CssSyntaxError.default(error) : error);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const warning of result.warnings()) {
|
||||
this.emitWarning(new _Warning.default(warning));
|
||||
}
|
||||
|
||||
const imports = [].concat(icssPluginImports.sort(_utils.sort)).concat(importPluginImports.sort(_utils.sort)).concat(urlPluginImports.sort(_utils.sort));
|
||||
const api = [].concat(importPluginApi.sort(_utils.sort)).concat(icssPluginApi.sort(_utils.sort));
|
||||
|
||||
if (options.modules.exportOnlyLocals !== true) {
|
||||
imports.unshift({
|
||||
importName: "___CSS_LOADER_API_IMPORT___",
|
||||
url: (0, _loaderUtils.stringifyRequest)(this, require.resolve("./runtime/api"))
|
||||
});
|
||||
|
||||
if (options.sourceMap) {
|
||||
imports.unshift({
|
||||
importName: "___CSS_LOADER_API_SOURCEMAP_IMPORT___",
|
||||
url: (0, _loaderUtils.stringifyRequest)(this, require.resolve("./runtime/cssWithMappingToString"))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const importCode = (0, _utils.getImportCode)(imports, options);
|
||||
const moduleCode = (0, _utils.getModuleCode)(result, api, replacements, options, this);
|
||||
const exportCode = (0, _utils.getExportCode)(exports, replacements, needToUseIcssPlugin, options);
|
||||
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
||||
}
|
149
node_modules/css-loader/dist/options.json
generated
vendored
Normal file
149
node_modules/css-loader/dist/options.json
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"url": {
|
||||
"description": "Enables/Disables 'url'/'image-set' functions handling (https://github.com/webpack-contrib/css-loader#url).",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"import": {
|
||||
"description": "Enables/Disables '@import' at-rules handling (https://github.com/webpack-contrib/css-loader#import).",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"modules": {
|
||||
"description": "Enables/Disables CSS Modules and their configuration (https://github.com/webpack-contrib/css-loader#modules).",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"enum": ["local", "global", "pure"]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"compileType": {
|
||||
"description": "Controls the extent to which css-loader will process module code (https://github.com/webpack-contrib/css-loader#type)",
|
||||
"enum": ["module", "icss"]
|
||||
},
|
||||
"auto": {
|
||||
"description": "Allows auto enable CSS modules based on filename (https://github.com/webpack-contrib/css-loader#auto).",
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mode": {
|
||||
"description": "Setup `mode` option (https://github.com/webpack-contrib/css-loader#mode).",
|
||||
"anyOf": [
|
||||
{
|
||||
"enum": ["local", "global", "pure"]
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"localIdentName": {
|
||||
"description": "Allows to configure the generated local ident name (https://github.com/webpack-contrib/css-loader#localidentname).",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"localIdentContext": {
|
||||
"description": "Allows to redefine basic loader context for local ident name (https://github.com/webpack-contrib/css-loader#localidentcontext).",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"localIdentHashPrefix": {
|
||||
"description": "Allows to add custom hash to generate more unique classes (https://github.com/webpack-contrib/css-loader#localidenthashprefix).",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"localIdentRegExp": {
|
||||
"description": "Allows to specify custom RegExp for local ident name (https://github.com/webpack-contrib/css-loader#localidentregexp).",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
}
|
||||
]
|
||||
},
|
||||
"getLocalIdent": {
|
||||
"description": "Allows to specify a function to generate the classname (https://github.com/webpack-contrib/css-loader#getlocalident).",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"namedExport": {
|
||||
"description": "Enables/disables ES modules named export for locals (https://github.com/webpack-contrib/css-loader#namedexport).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"exportGlobals": {
|
||||
"description": "Allows to export names from global class or id, so you can use that as local name (https://github.com/webpack-contrib/css-loader#exportglobals).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"exportLocalsConvention": {
|
||||
"description": "Style of exported classnames (https://github.com/webpack-contrib/css-loader#localsconvention).",
|
||||
"enum": [
|
||||
"asIs",
|
||||
"camelCase",
|
||||
"camelCaseOnly",
|
||||
"dashes",
|
||||
"dashesOnly"
|
||||
]
|
||||
},
|
||||
"exportOnlyLocals": {
|
||||
"description": "Export only locals (https://github.com/webpack-contrib/css-loader#exportonlylocals).",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"sourceMap": {
|
||||
"description": "Enables/Disables generation of source maps (https://github.com/webpack-contrib/css-loader#sourcemap).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"importLoaders": {
|
||||
"description": "Enables/Disables or setups number of loaders applied before CSS loader (https://github.com/webpack-contrib/css-loader#importloaders).",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"esModule": {
|
||||
"description": "Use the ES modules syntax (https://github.com/webpack-contrib/css-loader#esmodule).",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
31
node_modules/css-loader/dist/plugins/index.js
generated
vendored
Normal file
31
node_modules/css-loader/dist/plugins/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "importParser", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _postcssImportParser.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "icssParser", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _postcssIcssParser.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "urlParser", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _postcssUrlParser.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _postcssImportParser = _interopRequireDefault(require("./postcss-import-parser"));
|
||||
|
||||
var _postcssIcssParser = _interopRequireDefault(require("./postcss-icss-parser"));
|
||||
|
||||
var _postcssUrlParser = _interopRequireDefault(require("./postcss-url-parser"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
126
node_modules/css-loader/dist/plugins/postcss-icss-parser.js
generated
vendored
Normal file
126
node_modules/css-loader/dist/plugins/postcss-icss-parser.js
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _icssUtils = require("icss-utils");
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
const plugin = (options = {}) => {
|
||||
return {
|
||||
postcssPlugin: "postcss-icss-parser",
|
||||
|
||||
async OnceExit(root) {
|
||||
const importReplacements = Object.create(null);
|
||||
const {
|
||||
icssImports,
|
||||
icssExports
|
||||
} = (0, _icssUtils.extractICSS)(root);
|
||||
const imports = new Map();
|
||||
const tasks = []; // eslint-disable-next-line guard-for-in
|
||||
|
||||
for (const url in icssImports) {
|
||||
const tokens = icssImports[url];
|
||||
|
||||
if (Object.keys(tokens).length === 0) {
|
||||
// eslint-disable-next-line no-continue
|
||||
continue;
|
||||
}
|
||||
|
||||
let normalizedUrl = url;
|
||||
let prefix = "";
|
||||
const queryParts = normalizedUrl.split("!");
|
||||
|
||||
if (queryParts.length > 1) {
|
||||
normalizedUrl = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
|
||||
const request = (0, _utils.requestify)((0, _utils.normalizeUrl)(normalizedUrl, true), options.rootContext);
|
||||
|
||||
const doResolve = async () => {
|
||||
const {
|
||||
resolver,
|
||||
context
|
||||
} = options;
|
||||
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([normalizedUrl, request])]);
|
||||
|
||||
if (!resolvedUrl) {
|
||||
return;
|
||||
} // eslint-disable-next-line consistent-return
|
||||
|
||||
|
||||
return {
|
||||
url: resolvedUrl,
|
||||
prefix,
|
||||
tokens
|
||||
};
|
||||
};
|
||||
|
||||
tasks.push(doResolve());
|
||||
}
|
||||
|
||||
const results = await Promise.all(tasks);
|
||||
|
||||
for (let index = 0; index <= results.length - 1; index++) {
|
||||
const item = results[index];
|
||||
|
||||
if (!item) {
|
||||
// eslint-disable-next-line no-continue
|
||||
continue;
|
||||
}
|
||||
|
||||
const newUrl = item.prefix ? `${item.prefix}!${item.url}` : item.url;
|
||||
const importKey = newUrl;
|
||||
let importName = imports.get(importKey);
|
||||
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_ICSS_IMPORT_${imports.size}___`;
|
||||
imports.set(importKey, importName);
|
||||
options.imports.push({
|
||||
importName,
|
||||
url: options.urlHandler(newUrl),
|
||||
icss: true,
|
||||
index
|
||||
});
|
||||
options.api.push({
|
||||
importName,
|
||||
dedupe: true,
|
||||
index
|
||||
});
|
||||
}
|
||||
|
||||
for (const [replacementIndex, token] of Object.keys(item.tokens).entries()) {
|
||||
const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`;
|
||||
const localName = item.tokens[token];
|
||||
importReplacements[token] = replacementName;
|
||||
options.replacements.push({
|
||||
replacementName,
|
||||
importName,
|
||||
localName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(importReplacements).length > 0) {
|
||||
(0, _icssUtils.replaceSymbols)(root, importReplacements);
|
||||
}
|
||||
|
||||
for (const name of Object.keys(icssExports)) {
|
||||
const value = (0, _icssUtils.replaceValueSymbols)(icssExports[name], importReplacements);
|
||||
options.exports.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
plugin.postcss = true;
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
251
node_modules/css-loader/dist/plugins/postcss-import-parser.js
generated
vendored
Normal file
251
node_modules/css-loader/dist/plugins/postcss-import-parser.js
generated
vendored
Normal file
@ -0,0 +1,251 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function parseNode(atRule, key) {
|
||||
// Convert only top-level @import
|
||||
if (atRule.parent.type !== "root") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (atRule.raws && atRule.raws.afterName && atRule.raws.afterName.trim().length > 0) {
|
||||
const lastCommentIndex = atRule.raws.afterName.lastIndexOf("/*");
|
||||
const matched = atRule.raws.afterName.slice(lastCommentIndex).match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
|
||||
if (matched && matched[2] === "true") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const prevNode = atRule.prev();
|
||||
|
||||
if (prevNode && prevNode.type === "comment") {
|
||||
const matched = prevNode.text.match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
|
||||
if (matched && matched[2] === "true") {
|
||||
return;
|
||||
}
|
||||
} // Nodes do not exists - `@import url('http://') :root {}`
|
||||
|
||||
|
||||
if (atRule.nodes) {
|
||||
const error = new Error("It looks like you didn't end your @import statement correctly. Child nodes are attached to it.");
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
|
||||
const {
|
||||
nodes: paramsNodes
|
||||
} = (0, _postcssValueParser.default)(atRule[key]); // No nodes - `@import ;`
|
||||
// Invalid type - `@import foo-bar;`
|
||||
|
||||
if (paramsNodes.length === 0 || paramsNodes[0].type !== "string" && paramsNodes[0].type !== "function") {
|
||||
const error = new Error(`Unable to find uri in "${atRule.toString()}"`);
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
|
||||
let isStringValue;
|
||||
let url;
|
||||
|
||||
if (paramsNodes[0].type === "string") {
|
||||
isStringValue = true;
|
||||
url = paramsNodes[0].value;
|
||||
} else {
|
||||
// Invalid function - `@import nourl(test.css);`
|
||||
if (paramsNodes[0].value.toLowerCase() !== "url") {
|
||||
const error = new Error(`Unable to find uri in "${atRule.toString()}"`);
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
|
||||
isStringValue = paramsNodes[0].nodes.length !== 0 && paramsNodes[0].nodes[0].type === "string";
|
||||
url = isStringValue ? paramsNodes[0].nodes[0].value : _postcssValueParser.default.stringify(paramsNodes[0].nodes);
|
||||
}
|
||||
|
||||
url = (0, _utils.normalizeUrl)(url, isStringValue);
|
||||
const isRequestable = (0, _utils.isUrlRequestable)(url);
|
||||
let prefix;
|
||||
|
||||
if (isRequestable) {
|
||||
const queryParts = url.split("!");
|
||||
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
} // Empty url - `@import "";` or `@import url();`
|
||||
|
||||
|
||||
if (url.trim().length === 0) {
|
||||
const error = new Error(`Unable to find uri in "${atRule.toString()}"`);
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
|
||||
const mediaNodes = paramsNodes.slice(1);
|
||||
let media;
|
||||
|
||||
if (mediaNodes.length > 0) {
|
||||
media = _postcssValueParser.default.stringify(mediaNodes).trim().toLowerCase();
|
||||
} // eslint-disable-next-line consistent-return
|
||||
|
||||
|
||||
return {
|
||||
atRule,
|
||||
prefix,
|
||||
url,
|
||||
media,
|
||||
isRequestable
|
||||
};
|
||||
}
|
||||
|
||||
const plugin = (options = {}) => {
|
||||
return {
|
||||
postcssPlugin: "postcss-import-parser",
|
||||
|
||||
prepare(result) {
|
||||
const parsedAtRules = [];
|
||||
return {
|
||||
AtRule: {
|
||||
import(atRule) {
|
||||
let parsedAtRule;
|
||||
|
||||
try {
|
||||
parsedAtRule = parseNode(atRule, "params", result);
|
||||
} catch (error) {
|
||||
result.warn(error.message, {
|
||||
node: error.node
|
||||
});
|
||||
}
|
||||
|
||||
if (!parsedAtRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
parsedAtRules.push(parsedAtRule);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
async OnceExit() {
|
||||
if (parsedAtRules.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const resolvedAtRules = await Promise.all(parsedAtRules.map(async parsedAtRule => {
|
||||
const {
|
||||
atRule,
|
||||
isRequestable,
|
||||
prefix,
|
||||
url,
|
||||
media
|
||||
} = parsedAtRule;
|
||||
|
||||
if (options.filter) {
|
||||
const needKeep = await options.filter(url, media);
|
||||
|
||||
if (!needKeep) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isRequestable) {
|
||||
const request = (0, _utils.requestify)(url, options.rootContext);
|
||||
const {
|
||||
resolver,
|
||||
context
|
||||
} = options;
|
||||
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([request, url])]);
|
||||
|
||||
if (!resolvedUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
atRule.remove(); // eslint-disable-next-line consistent-return
|
||||
|
||||
return {
|
||||
url: resolvedUrl,
|
||||
media,
|
||||
prefix,
|
||||
isRequestable
|
||||
};
|
||||
}
|
||||
|
||||
atRule.remove(); // eslint-disable-next-line consistent-return
|
||||
|
||||
return {
|
||||
url,
|
||||
media,
|
||||
prefix,
|
||||
isRequestable
|
||||
};
|
||||
}));
|
||||
const urlToNameMap = new Map();
|
||||
|
||||
for (let index = 0; index <= resolvedAtRules.length - 1; index++) {
|
||||
const resolvedAtRule = resolvedAtRules[index];
|
||||
|
||||
if (!resolvedAtRule) {
|
||||
// eslint-disable-next-line no-continue
|
||||
continue;
|
||||
}
|
||||
|
||||
const {
|
||||
url,
|
||||
isRequestable,
|
||||
media
|
||||
} = resolvedAtRule;
|
||||
|
||||
if (!isRequestable) {
|
||||
options.api.push({
|
||||
url,
|
||||
media,
|
||||
index
|
||||
}); // eslint-disable-next-line no-continue
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
const {
|
||||
prefix
|
||||
} = resolvedAtRule;
|
||||
const newUrl = prefix ? `${prefix}!${url}` : url;
|
||||
let importName = urlToNameMap.get(newUrl);
|
||||
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_AT_RULE_IMPORT_${urlToNameMap.size}___`;
|
||||
urlToNameMap.set(newUrl, importName);
|
||||
options.imports.push({
|
||||
importName,
|
||||
url: options.urlHandler(newUrl),
|
||||
index
|
||||
});
|
||||
}
|
||||
|
||||
options.api.push({
|
||||
importName,
|
||||
media,
|
||||
index
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
plugin.postcss = true;
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
373
node_modules/css-loader/dist/plugins/postcss-url-parser.js
generated
vendored
Normal file
373
node_modules/css-loader/dist/plugins/postcss-url-parser.js
generated
vendored
Normal file
@ -0,0 +1,373 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const isUrlFunc = /url/i;
|
||||
const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
|
||||
const needParseDeclaration = /(?:url|(?:-webkit-)?image-set)\(/i;
|
||||
|
||||
function getNodeFromUrlFunc(node) {
|
||||
return node.nodes && node.nodes[0];
|
||||
}
|
||||
|
||||
function getWebpackIgnoreCommentValue(index, nodes, inBetween) {
|
||||
if (index === 0 && typeof inBetween !== "undefined") {
|
||||
return inBetween;
|
||||
}
|
||||
|
||||
let prevValueNode = nodes[index - 1];
|
||||
|
||||
if (!prevValueNode) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
|
||||
if (prevValueNode.type === "space") {
|
||||
if (!nodes[index - 2]) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
|
||||
prevValueNode = nodes[index - 2];
|
||||
}
|
||||
|
||||
if (prevValueNode.type !== "comment") {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
|
||||
const matched = prevValueNode.value.match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
return matched && matched[2] === "true";
|
||||
}
|
||||
|
||||
function shouldHandleURL(url, declaration, result) {
|
||||
if (url.length === 0) {
|
||||
result.warn(`Unable to find uri in '${declaration.toString()}'`, {
|
||||
node: declaration
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(0, _utils.isUrlRequestable)(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function parseDeclaration(declaration, key, result) {
|
||||
if (!needParseDeclaration.test(declaration[key])) {
|
||||
return;
|
||||
}
|
||||
|
||||
const parsed = (0, _postcssValueParser.default)(declaration.raws && declaration.raws.value && declaration.raws.value.raw ? declaration.raws.value.raw : declaration[key]);
|
||||
let inBetween;
|
||||
|
||||
if (declaration.raws && declaration.raws.between) {
|
||||
const lastCommentIndex = declaration.raws.between.lastIndexOf("/*");
|
||||
const matched = declaration.raws.between.slice(lastCommentIndex).match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
|
||||
if (matched) {
|
||||
inBetween = matched[2] === "true";
|
||||
}
|
||||
}
|
||||
|
||||
let isIgnoreOnDeclaration = false;
|
||||
const prevNode = declaration.prev();
|
||||
|
||||
if (prevNode && prevNode.type === "comment") {
|
||||
const matched = prevNode.text.match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
|
||||
if (matched) {
|
||||
isIgnoreOnDeclaration = matched[2] === "true";
|
||||
}
|
||||
}
|
||||
|
||||
let needIgnore;
|
||||
const parsedURLs = [];
|
||||
parsed.walk((valueNode, index, valueNodes) => {
|
||||
if (valueNode.type !== "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isUrlFunc.test(valueNode.value)) {
|
||||
needIgnore = getWebpackIgnoreCommentValue(index, valueNodes, inBetween);
|
||||
|
||||
if (isIgnoreOnDeclaration && typeof needIgnore === "undefined" || needIgnore) {
|
||||
if (needIgnore) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
needIgnore = undefined;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
nodes
|
||||
} = valueNode;
|
||||
const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
|
||||
let url = isStringValue ? nodes[0].value : _postcssValueParser.default.stringify(nodes);
|
||||
url = (0, _utils.normalizeUrl)(url, isStringValue); // Do not traverse inside `url`
|
||||
|
||||
if (!shouldHandleURL(url, declaration, result)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
|
||||
parsedURLs.push({
|
||||
declaration,
|
||||
parsed,
|
||||
node: getNodeFromUrlFunc(valueNode),
|
||||
prefix,
|
||||
url,
|
||||
needQuotes: false
|
||||
}); // eslint-disable-next-line consistent-return
|
||||
|
||||
return false;
|
||||
} else if (isImageSetFunc.test(valueNode.value)) {
|
||||
for (const [innerIndex, nNode] of valueNode.nodes.entries()) {
|
||||
const {
|
||||
type,
|
||||
value
|
||||
} = nNode;
|
||||
|
||||
if (type === "function" && isUrlFunc.test(value)) {
|
||||
needIgnore = getWebpackIgnoreCommentValue(innerIndex, valueNode.nodes);
|
||||
|
||||
if (isIgnoreOnDeclaration && typeof needIgnore === "undefined" || needIgnore) {
|
||||
if (needIgnore) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
needIgnore = undefined;
|
||||
} // eslint-disable-next-line no-continue
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
const {
|
||||
nodes
|
||||
} = nNode;
|
||||
const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
|
||||
let url = isStringValue ? nodes[0].value : _postcssValueParser.default.stringify(nodes);
|
||||
url = (0, _utils.normalizeUrl)(url, isStringValue); // Do not traverse inside `url`
|
||||
|
||||
if (!shouldHandleURL(url, declaration, result)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
|
||||
parsedURLs.push({
|
||||
declaration,
|
||||
parsed,
|
||||
node: getNodeFromUrlFunc(nNode),
|
||||
prefix,
|
||||
url,
|
||||
needQuotes: false
|
||||
});
|
||||
} else if (type === "string") {
|
||||
needIgnore = getWebpackIgnoreCommentValue(innerIndex, valueNode.nodes);
|
||||
|
||||
if (isIgnoreOnDeclaration && typeof needIgnore === "undefined" || needIgnore) {
|
||||
if (needIgnore) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
needIgnore = undefined;
|
||||
} // eslint-disable-next-line no-continue
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
let url = (0, _utils.normalizeUrl)(value, true); // Do not traverse inside `url`
|
||||
|
||||
if (!shouldHandleURL(url, declaration, result)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
|
||||
parsedURLs.push({
|
||||
declaration,
|
||||
parsed,
|
||||
node: nNode,
|
||||
prefix,
|
||||
url,
|
||||
needQuotes: true
|
||||
});
|
||||
}
|
||||
} // Do not traverse inside `image-set`
|
||||
// eslint-disable-next-line consistent-return
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}); // eslint-disable-next-line consistent-return
|
||||
|
||||
return parsedURLs;
|
||||
}
|
||||
|
||||
const plugin = (options = {}) => {
|
||||
return {
|
||||
postcssPlugin: "postcss-url-parser",
|
||||
|
||||
prepare(result) {
|
||||
const parsedDeclarations = [];
|
||||
return {
|
||||
Declaration(declaration) {
|
||||
const parsedURL = parseDeclaration(declaration, "value", result);
|
||||
|
||||
if (!parsedURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
parsedDeclarations.push(...parsedURL);
|
||||
},
|
||||
|
||||
async OnceExit() {
|
||||
if (parsedDeclarations.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const resolvedDeclarations = await Promise.all(parsedDeclarations.map(async parsedDeclaration => {
|
||||
const {
|
||||
url
|
||||
} = parsedDeclaration;
|
||||
|
||||
if (options.filter) {
|
||||
const needKeep = await options.filter(url);
|
||||
|
||||
if (!needKeep) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const splittedUrl = url.split(/(\?)?#/);
|
||||
const [pathname, query, hashOrQuery] = splittedUrl;
|
||||
let hash = query ? "?" : "";
|
||||
hash += hashOrQuery ? `#${hashOrQuery}` : "";
|
||||
const request = (0, _utils.requestify)(pathname, options.rootContext);
|
||||
const {
|
||||
resolver,
|
||||
context
|
||||
} = options;
|
||||
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([request, url])]);
|
||||
|
||||
if (!resolvedUrl) {
|
||||
return;
|
||||
} // eslint-disable-next-line consistent-return
|
||||
|
||||
|
||||
return { ...parsedDeclaration,
|
||||
url: resolvedUrl,
|
||||
hash
|
||||
};
|
||||
}));
|
||||
const urlToNameMap = new Map();
|
||||
const urlToReplacementMap = new Map();
|
||||
let hasUrlImportHelper = false;
|
||||
|
||||
for (let index = 0; index <= resolvedDeclarations.length - 1; index++) {
|
||||
const item = resolvedDeclarations[index];
|
||||
|
||||
if (!item) {
|
||||
// eslint-disable-next-line no-continue
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hasUrlImportHelper) {
|
||||
options.imports.push({
|
||||
importName: "___CSS_LOADER_GET_URL_IMPORT___",
|
||||
url: options.urlHandler(require.resolve("../runtime/getUrl.js")),
|
||||
index: -1
|
||||
});
|
||||
hasUrlImportHelper = true;
|
||||
}
|
||||
|
||||
const {
|
||||
url,
|
||||
prefix
|
||||
} = item;
|
||||
const newUrl = prefix ? `${prefix}!${url}` : url;
|
||||
let importName = urlToNameMap.get(newUrl);
|
||||
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`;
|
||||
urlToNameMap.set(newUrl, importName);
|
||||
options.imports.push({
|
||||
importName,
|
||||
url: options.urlHandler(newUrl),
|
||||
index
|
||||
});
|
||||
}
|
||||
|
||||
const {
|
||||
hash,
|
||||
needQuotes
|
||||
} = item;
|
||||
const replacementKey = JSON.stringify({
|
||||
newUrl,
|
||||
hash,
|
||||
needQuotes
|
||||
});
|
||||
let replacementName = urlToReplacementMap.get(replacementKey);
|
||||
|
||||
if (!replacementName) {
|
||||
replacementName = `___CSS_LOADER_URL_REPLACEMENT_${urlToReplacementMap.size}___`;
|
||||
urlToReplacementMap.set(replacementKey, replacementName);
|
||||
options.replacements.push({
|
||||
replacementName,
|
||||
importName,
|
||||
hash,
|
||||
needQuotes
|
||||
});
|
||||
} // eslint-disable-next-line no-param-reassign
|
||||
|
||||
|
||||
item.node.type = "word"; // eslint-disable-next-line no-param-reassign
|
||||
|
||||
item.node.value = replacementName; // eslint-disable-next-line no-param-reassign
|
||||
|
||||
item.declaration.value = item.parsed.toString();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
plugin.postcss = true;
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
66
node_modules/css-loader/dist/runtime/api.js
generated
vendored
Normal file
66
node_modules/css-loader/dist/runtime/api.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
// css base code, injected by the css-loader
|
||||
// eslint-disable-next-line func-names
|
||||
module.exports = function (cssWithMappingToString) {
|
||||
var list = []; // return the list of modules as css string
|
||||
|
||||
list.toString = function toString() {
|
||||
return this.map(function (item) {
|
||||
var content = cssWithMappingToString(item);
|
||||
|
||||
if (item[2]) {
|
||||
return "@media ".concat(item[2], " {").concat(content, "}");
|
||||
}
|
||||
|
||||
return content;
|
||||
}).join("");
|
||||
}; // import a list of modules into the list
|
||||
// eslint-disable-next-line func-names
|
||||
|
||||
|
||||
list.i = function (modules, mediaQuery, dedupe) {
|
||||
if (typeof modules === "string") {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
modules = [[null, modules, ""]];
|
||||
}
|
||||
|
||||
var alreadyImportedModules = {};
|
||||
|
||||
if (dedupe) {
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
var id = this[i][0];
|
||||
|
||||
if (id != null) {
|
||||
alreadyImportedModules[id] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < modules.length; _i++) {
|
||||
var item = [].concat(modules[_i]);
|
||||
|
||||
if (dedupe && alreadyImportedModules[item[0]]) {
|
||||
// eslint-disable-next-line no-continue
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mediaQuery) {
|
||||
if (!item[2]) {
|
||||
item[2] = mediaQuery;
|
||||
} else {
|
||||
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
|
||||
}
|
||||
}
|
||||
|
||||
list.push(item);
|
||||
}
|
||||
};
|
||||
|
||||
return list;
|
||||
};
|
36
node_modules/css-loader/dist/runtime/cssWithMappingToString.js
generated
vendored
Normal file
36
node_modules/css-loader/dist/runtime/cssWithMappingToString.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
module.exports = function cssWithMappingToString(item) {
|
||||
var _item = _slicedToArray(item, 4),
|
||||
content = _item[1],
|
||||
cssMapping = _item[3];
|
||||
|
||||
if (!cssMapping) {
|
||||
return content;
|
||||
}
|
||||
|
||||
if (typeof btoa === "function") {
|
||||
// eslint-disable-next-line no-undef
|
||||
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
|
||||
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
|
||||
var sourceMapping = "/*# ".concat(data, " */");
|
||||
var sourceURLs = cssMapping.sources.map(function (source) {
|
||||
return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */");
|
||||
});
|
||||
return [content].concat(sourceURLs).concat([sourceMapping]).join("\n");
|
||||
}
|
||||
|
||||
return [content].join("\n");
|
||||
};
|
34
node_modules/css-loader/dist/runtime/getUrl.js
generated
vendored
Normal file
34
node_modules/css-loader/dist/runtime/getUrl.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (url, options) {
|
||||
if (!options) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
options = {};
|
||||
} // eslint-disable-next-line no-underscore-dangle, no-param-reassign
|
||||
|
||||
|
||||
url = url && url.__esModule ? url.default : url;
|
||||
|
||||
if (typeof url !== "string") {
|
||||
return url;
|
||||
} // If url is already wrapped in quotes, remove them
|
||||
|
||||
|
||||
if (/^['"].*['"]$/.test(url)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = url.slice(1, -1);
|
||||
}
|
||||
|
||||
if (options.hash) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url += options.hash;
|
||||
} // Should url be wrapped?
|
||||
// See https://drafts.csswg.org/css-values-3/#urls
|
||||
|
||||
|
||||
if (/["'() \t\n]/.test(url) || options.needQuotes) {
|
||||
return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\"");
|
||||
}
|
||||
|
||||
return url;
|
||||
};
|
825
node_modules/css-loader/dist/utils.js
generated
vendored
Normal file
825
node_modules/css-loader/dist/utils.js
generated
vendored
Normal file
@ -0,0 +1,825 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.normalizeOptions = normalizeOptions;
|
||||
exports.shouldUseModulesPlugins = shouldUseModulesPlugins;
|
||||
exports.shouldUseImportPlugin = shouldUseImportPlugin;
|
||||
exports.shouldUseURLPlugin = shouldUseURLPlugin;
|
||||
exports.shouldUseIcssPlugin = shouldUseIcssPlugin;
|
||||
exports.normalizeUrl = normalizeUrl;
|
||||
exports.requestify = requestify;
|
||||
exports.getFilter = getFilter;
|
||||
exports.getModulesOptions = getModulesOptions;
|
||||
exports.getModulesPlugins = getModulesPlugins;
|
||||
exports.normalizeSourceMap = normalizeSourceMap;
|
||||
exports.getPreRequester = getPreRequester;
|
||||
exports.getImportCode = getImportCode;
|
||||
exports.getModuleCode = getModuleCode;
|
||||
exports.getExportCode = getExportCode;
|
||||
exports.resolveRequests = resolveRequests;
|
||||
exports.isUrlRequestable = isUrlRequestable;
|
||||
exports.sort = sort;
|
||||
exports.combineRequests = combineRequests;
|
||||
exports.camelCase = camelCase;
|
||||
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
||||
|
||||
var _url = require("url");
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _loaderUtils = require("loader-utils");
|
||||
|
||||
var _postcssModulesValues = _interopRequireDefault(require("postcss-modules-values"));
|
||||
|
||||
var _postcssModulesLocalByDefault = _interopRequireDefault(require("postcss-modules-local-by-default"));
|
||||
|
||||
var _postcssModulesExtractImports = _interopRequireDefault(require("postcss-modules-extract-imports"));
|
||||
|
||||
var _postcssModulesScope = _interopRequireDefault(require("postcss-modules-scope"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
const WEBPACK_IGNORE_COMMENT_REGEXP = /webpackIgnore:(\s+)?(true|false)/; // eslint-disable-next-line no-useless-escape
|
||||
|
||||
exports.WEBPACK_IGNORE_COMMENT_REGEXP = WEBPACK_IGNORE_COMMENT_REGEXP;
|
||||
const regexSingleEscape = /[ -,.\/:-@[\]\^`{-~]/;
|
||||
const regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
|
||||
|
||||
const preserveCamelCase = string => {
|
||||
let result = string;
|
||||
let isLastCharLower = false;
|
||||
let isLastCharUpper = false;
|
||||
let isLastLastCharUpper = false;
|
||||
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
const character = result[i];
|
||||
|
||||
if (isLastCharLower && /[\p{Lu}]/u.test(character)) {
|
||||
result = `${result.slice(0, i)}-${result.slice(i)}`;
|
||||
isLastCharLower = false;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = true;
|
||||
i += 1;
|
||||
} else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) {
|
||||
result = `${result.slice(0, i - 1)}-${result.slice(i - 1)}`;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = false;
|
||||
isLastCharLower = true;
|
||||
} else {
|
||||
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
function camelCase(input) {
|
||||
let result = input.trim();
|
||||
|
||||
if (result.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (result.length === 1) {
|
||||
return result.toLowerCase();
|
||||
}
|
||||
|
||||
const hasUpperCase = result !== result.toLowerCase();
|
||||
|
||||
if (hasUpperCase) {
|
||||
result = preserveCamelCase(result);
|
||||
}
|
||||
|
||||
return result.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase()).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase());
|
||||
}
|
||||
|
||||
function escape(string) {
|
||||
let output = "";
|
||||
let counter = 0;
|
||||
|
||||
while (counter < string.length) {
|
||||
// eslint-disable-next-line no-plusplus
|
||||
const character = string.charAt(counter++);
|
||||
let value; // eslint-disable-next-line no-control-regex
|
||||
|
||||
if (/[\t\n\f\r\x0B]/.test(character)) {
|
||||
const codePoint = character.charCodeAt();
|
||||
value = `\\${codePoint.toString(16).toUpperCase()} `;
|
||||
} else if (character === "\\" || regexSingleEscape.test(character)) {
|
||||
value = `\\${character}`;
|
||||
} else {
|
||||
value = character;
|
||||
}
|
||||
|
||||
output += value;
|
||||
}
|
||||
|
||||
const firstChar = string.charAt(0);
|
||||
|
||||
if (/^-[-\d]/.test(output)) {
|
||||
output = `\\-${output.slice(1)}`;
|
||||
} else if (/\d/.test(firstChar)) {
|
||||
output = `\\3${firstChar} ${output.slice(1)}`;
|
||||
} // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
|
||||
// since they’re redundant. Note that this is only possible if the escape
|
||||
// sequence isn’t preceded by an odd number of backslashes.
|
||||
|
||||
|
||||
output = output.replace(regexExcessiveSpaces, ($0, $1, $2) => {
|
||||
if ($1 && $1.length % 2) {
|
||||
// It’s not safe to remove the space, so don’t.
|
||||
return $0;
|
||||
} // Strip the space.
|
||||
|
||||
|
||||
return ($1 || "") + $2;
|
||||
});
|
||||
return output;
|
||||
}
|
||||
|
||||
function gobbleHex(str) {
|
||||
const lower = str.toLowerCase();
|
||||
let hex = "";
|
||||
let spaceTerminated = false; // eslint-disable-next-line no-undefined
|
||||
|
||||
for (let i = 0; i < 6 && lower[i] !== undefined; i++) {
|
||||
const code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
|
||||
|
||||
const valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
|
||||
|
||||
spaceTerminated = code === 32;
|
||||
|
||||
if (!valid) {
|
||||
break;
|
||||
}
|
||||
|
||||
hex += lower[i];
|
||||
}
|
||||
|
||||
if (hex.length === 0) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const codePoint = parseInt(hex, 16);
|
||||
const isSurrogate = codePoint >= 0xd800 && codePoint <= 0xdfff; // Add special case for
|
||||
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
|
||||
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
|
||||
|
||||
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10ffff) {
|
||||
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
|
||||
}
|
||||
|
||||
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
|
||||
}
|
||||
|
||||
const CONTAINS_ESCAPE = /\\/;
|
||||
|
||||
function unescape(str) {
|
||||
const needToProcess = CONTAINS_ESCAPE.test(str);
|
||||
|
||||
if (!needToProcess) {
|
||||
return str;
|
||||
}
|
||||
|
||||
let ret = "";
|
||||
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
if (str[i] === "\\") {
|
||||
const gobbled = gobbleHex(str.slice(i + 1, i + 7)); // eslint-disable-next-line no-undefined
|
||||
|
||||
if (gobbled !== undefined) {
|
||||
ret += gobbled[0];
|
||||
i += gobbled[1]; // eslint-disable-next-line no-continue
|
||||
|
||||
continue;
|
||||
} // Retain a pair of \\ if double escaped `\\\\`
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
|
||||
|
||||
|
||||
if (str[i + 1] === "\\") {
|
||||
ret += "\\";
|
||||
i += 1; // eslint-disable-next-line no-continue
|
||||
|
||||
continue;
|
||||
} // if \\ is at the end of the string retain it
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
|
||||
|
||||
|
||||
if (str.length === i + 1) {
|
||||
ret += str[i];
|
||||
} // eslint-disable-next-line no-continue
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
ret += str[i];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function normalizePath(file) {
|
||||
return _path.default.sep === "\\" ? file.replace(/\\/g, "/") : file;
|
||||
} // eslint-disable-next-line no-control-regex
|
||||
|
||||
|
||||
const filenameReservedRegex = /[<>:"/\\|?*]/g; // eslint-disable-next-line no-control-regex
|
||||
|
||||
const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g;
|
||||
|
||||
function escapeLocalIdent(localident) {
|
||||
// TODO simplify in the next major release
|
||||
return escape(localident // For `[hash]` placeholder
|
||||
.replace(/^((-?[0-9])|--)/, "_$1").replace(filenameReservedRegex, "-").replace(reControlChars, "-").replace(/\./g, "-"));
|
||||
}
|
||||
|
||||
function defaultGetLocalIdent(loaderContext, localIdentName, localName, options) {
|
||||
let relativeMatchResource = ""; // eslint-disable-next-line no-underscore-dangle
|
||||
|
||||
if (loaderContext._module && loaderContext._module.matchResource) {
|
||||
relativeMatchResource = `${normalizePath( // eslint-disable-next-line no-underscore-dangle
|
||||
_path.default.relative(options.context, loaderContext._module.matchResource))}\x00`;
|
||||
}
|
||||
|
||||
const relativeResourcePath = normalizePath(_path.default.relative(options.context, loaderContext.resourcePath)); // eslint-disable-next-line no-param-reassign
|
||||
|
||||
options.content = `${options.hashPrefix}${relativeMatchResource}${relativeResourcePath}\x00${localName}`;
|
||||
return (0, _loaderUtils.interpolateName)(loaderContext, localIdentName, options);
|
||||
}
|
||||
|
||||
const NATIVE_WIN32_PATH = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
|
||||
function normalizeUrl(url, isStringValue) {
|
||||
let normalizedUrl = url.replace(/^( |\t\n|\r\n|\r|\f)*/g, "").replace(/( |\t\n|\r\n|\r|\f)*$/g, "");
|
||||
|
||||
if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
|
||||
normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, "");
|
||||
}
|
||||
|
||||
if (NATIVE_WIN32_PATH.test(url)) {
|
||||
try {
|
||||
normalizedUrl = decodeURI(normalizedUrl);
|
||||
} catch (error) {// Ignore
|
||||
}
|
||||
|
||||
return normalizedUrl;
|
||||
}
|
||||
|
||||
normalizedUrl = unescape(normalizedUrl);
|
||||
|
||||
try {
|
||||
normalizedUrl = decodeURI(normalizedUrl);
|
||||
} catch (error) {// Ignore
|
||||
}
|
||||
|
||||
return normalizedUrl;
|
||||
}
|
||||
|
||||
function requestify(url, rootContext) {
|
||||
if (/^file:/i.test(url)) {
|
||||
return (0, _url.fileURLToPath)(url);
|
||||
}
|
||||
|
||||
return url.charAt(0) === "/" ? (0, _loaderUtils.urlToRequest)(url, rootContext) : (0, _loaderUtils.urlToRequest)(url);
|
||||
}
|
||||
|
||||
function getFilter(filter, resourcePath) {
|
||||
return (...args) => {
|
||||
if (typeof filter === "function") {
|
||||
return filter(...args, resourcePath);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
function getValidLocalName(localName, exportLocalsConvention) {
|
||||
if (exportLocalsConvention === "dashesOnly") {
|
||||
return dashesCamelCase(localName);
|
||||
}
|
||||
|
||||
return camelCase(localName);
|
||||
}
|
||||
|
||||
const moduleRegExp = /\.module(s)?\.\w+$/i;
|
||||
const icssRegExp = /\.icss\.\w+$/i;
|
||||
|
||||
function getModulesOptions(rawOptions, loaderContext) {
|
||||
const resourcePath = // eslint-disable-next-line no-underscore-dangle
|
||||
loaderContext._module && loaderContext._module.matchResource || loaderContext.resourcePath;
|
||||
let isIcss;
|
||||
|
||||
if (typeof rawOptions.modules === "undefined") {
|
||||
const isModules = moduleRegExp.test(resourcePath);
|
||||
|
||||
if (!isModules) {
|
||||
isIcss = icssRegExp.test(resourcePath);
|
||||
}
|
||||
|
||||
if (!isModules && !isIcss) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeof rawOptions.modules === "boolean" && rawOptions.modules === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let modulesOptions = {
|
||||
compileType: isIcss ? "icss" : "module",
|
||||
auto: true,
|
||||
mode: "local",
|
||||
exportGlobals: false,
|
||||
localIdentName: "[hash:base64]",
|
||||
localIdentContext: loaderContext.rootContext,
|
||||
localIdentHashPrefix: "",
|
||||
// eslint-disable-next-line no-undefined
|
||||
localIdentRegExp: undefined,
|
||||
// eslint-disable-next-line no-undefined
|
||||
getLocalIdent: undefined,
|
||||
namedExport: false,
|
||||
exportLocalsConvention: "asIs",
|
||||
exportOnlyLocals: false
|
||||
};
|
||||
|
||||
if (typeof rawOptions.modules === "boolean" || typeof rawOptions.modules === "string") {
|
||||
modulesOptions.mode = typeof rawOptions.modules === "string" ? rawOptions.modules : "local";
|
||||
} else {
|
||||
if (rawOptions.modules) {
|
||||
if (typeof rawOptions.modules.auto === "boolean") {
|
||||
const isModules = rawOptions.modules.auto && moduleRegExp.test(resourcePath);
|
||||
|
||||
if (!isModules) {
|
||||
return false;
|
||||
}
|
||||
} else if (rawOptions.modules.auto instanceof RegExp) {
|
||||
const isModules = rawOptions.modules.auto.test(resourcePath);
|
||||
|
||||
if (!isModules) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeof rawOptions.modules.auto === "function") {
|
||||
const isModule = rawOptions.modules.auto(resourcePath);
|
||||
|
||||
if (!isModule) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rawOptions.modules.namedExport === true && typeof rawOptions.modules.exportLocalsConvention === "undefined") {
|
||||
modulesOptions.exportLocalsConvention = "camelCaseOnly";
|
||||
}
|
||||
}
|
||||
|
||||
modulesOptions = { ...modulesOptions,
|
||||
...(rawOptions.modules || {})
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof modulesOptions.mode === "function") {
|
||||
modulesOptions.mode = modulesOptions.mode(loaderContext.resourcePath);
|
||||
}
|
||||
|
||||
if (modulesOptions.namedExport === true) {
|
||||
if (rawOptions.esModule === false) {
|
||||
throw new Error('The "modules.namedExport" option requires the "esModules" option to be enabled');
|
||||
}
|
||||
|
||||
if (modulesOptions.exportLocalsConvention !== "camelCaseOnly" && modulesOptions.exportLocalsConvention !== "dashesOnly") {
|
||||
throw new Error('The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "camelCaseOnly" or "dashesOnly"');
|
||||
}
|
||||
}
|
||||
|
||||
if (/\[emoji(?::(\d+))?\]/i.test(modulesOptions.localIdentName)) {
|
||||
loaderContext.emitWarning("Emoji is deprecated and will be removed in next major release.");
|
||||
}
|
||||
|
||||
return modulesOptions;
|
||||
}
|
||||
|
||||
function normalizeOptions(rawOptions, loaderContext) {
|
||||
const modulesOptions = getModulesOptions(rawOptions, loaderContext);
|
||||
return {
|
||||
url: typeof rawOptions.url === "undefined" ? true : rawOptions.url,
|
||||
import: typeof rawOptions.import === "undefined" ? true : rawOptions.import,
|
||||
modules: modulesOptions,
|
||||
sourceMap: typeof rawOptions.sourceMap === "boolean" ? rawOptions.sourceMap : loaderContext.sourceMap,
|
||||
importLoaders: typeof rawOptions.importLoaders === "string" ? parseInt(rawOptions.importLoaders, 10) : rawOptions.importLoaders,
|
||||
esModule: typeof rawOptions.esModule === "undefined" ? true : rawOptions.esModule
|
||||
};
|
||||
}
|
||||
|
||||
function shouldUseImportPlugin(options) {
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof options.import === "boolean") {
|
||||
return options.import;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function shouldUseURLPlugin(options) {
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof options.url === "boolean") {
|
||||
return options.url;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function shouldUseModulesPlugins(options) {
|
||||
return options.modules.compileType === "module";
|
||||
}
|
||||
|
||||
function shouldUseIcssPlugin(options) {
|
||||
return options.icss === true || Boolean(options.modules);
|
||||
}
|
||||
|
||||
function getModulesPlugins(options, loaderContext) {
|
||||
const {
|
||||
mode,
|
||||
getLocalIdent,
|
||||
localIdentName,
|
||||
localIdentContext,
|
||||
localIdentHashPrefix,
|
||||
localIdentRegExp
|
||||
} = options.modules;
|
||||
let plugins = [];
|
||||
|
||||
try {
|
||||
plugins = [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({
|
||||
mode
|
||||
}), (0, _postcssModulesExtractImports.default)(), (0, _postcssModulesScope.default)({
|
||||
generateScopedName(exportName) {
|
||||
let localIdent;
|
||||
|
||||
if (typeof getLocalIdent !== "undefined") {
|
||||
localIdent = getLocalIdent(loaderContext, localIdentName, unescape(exportName), {
|
||||
context: localIdentContext,
|
||||
hashPrefix: localIdentHashPrefix,
|
||||
regExp: localIdentRegExp
|
||||
});
|
||||
} // A null/undefined value signals that we should invoke the default
|
||||
// getLocalIdent method.
|
||||
|
||||
|
||||
if (typeof localIdent === "undefined" || localIdent === null) {
|
||||
localIdent = defaultGetLocalIdent(loaderContext, localIdentName, unescape(exportName), {
|
||||
context: localIdentContext,
|
||||
hashPrefix: localIdentHashPrefix,
|
||||
regExp: localIdentRegExp
|
||||
});
|
||||
return escapeLocalIdent(localIdent).replace(/\\\[local\\]/gi, exportName);
|
||||
}
|
||||
|
||||
return escapeLocalIdent(localIdent);
|
||||
},
|
||||
|
||||
exportGlobals: options.modules.exportGlobals
|
||||
})];
|
||||
} catch (error) {
|
||||
loaderContext.emitError(error);
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
|
||||
const ABSOLUTE_SCHEME = /^[a-z0-9+\-.]+:/i;
|
||||
|
||||
function getURLType(source) {
|
||||
if (source[0] === "/") {
|
||||
if (source[1] === "/") {
|
||||
return "scheme-relative";
|
||||
}
|
||||
|
||||
return "path-absolute";
|
||||
}
|
||||
|
||||
if (IS_NATIVE_WIN32_PATH.test(source)) {
|
||||
return "path-absolute";
|
||||
}
|
||||
|
||||
return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
|
||||
}
|
||||
|
||||
function normalizeSourceMap(map, resourcePath) {
|
||||
let newMap = map; // Some loader emit source map as string
|
||||
// Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification), and then parse the string as JSON.
|
||||
|
||||
if (typeof newMap === "string") {
|
||||
newMap = JSON.parse(newMap);
|
||||
}
|
||||
|
||||
delete newMap.file;
|
||||
const {
|
||||
sourceRoot
|
||||
} = newMap;
|
||||
delete newMap.sourceRoot;
|
||||
|
||||
if (newMap.sources) {
|
||||
// Source maps should use forward slash because it is URLs (https://github.com/mozilla/source-map/issues/91)
|
||||
// We should normalize path because previous loaders like `sass-loader` using backslash when generate source map
|
||||
newMap.sources = newMap.sources.map(source => {
|
||||
// Non-standard syntax from `postcss`
|
||||
if (source.indexOf("<") === 0) {
|
||||
return source;
|
||||
}
|
||||
|
||||
const sourceType = getURLType(source); // Do no touch `scheme-relative` and `absolute` URLs
|
||||
|
||||
if (sourceType === "path-relative" || sourceType === "path-absolute") {
|
||||
const absoluteSource = sourceType === "path-relative" && sourceRoot ? _path.default.resolve(sourceRoot, normalizePath(source)) : normalizePath(source);
|
||||
return _path.default.relative(_path.default.dirname(resourcePath), absoluteSource);
|
||||
}
|
||||
|
||||
return source;
|
||||
});
|
||||
}
|
||||
|
||||
return newMap;
|
||||
}
|
||||
|
||||
function getPreRequester({
|
||||
loaders,
|
||||
loaderIndex
|
||||
}) {
|
||||
const cache = Object.create(null);
|
||||
return number => {
|
||||
if (cache[number]) {
|
||||
return cache[number];
|
||||
}
|
||||
|
||||
if (number === false) {
|
||||
cache[number] = "";
|
||||
} else {
|
||||
const loadersRequest = loaders.slice(loaderIndex, loaderIndex + 1 + (typeof number !== "number" ? 0 : number)).map(x => x.request).join("!");
|
||||
cache[number] = `-!${loadersRequest}!`;
|
||||
}
|
||||
|
||||
return cache[number];
|
||||
};
|
||||
}
|
||||
|
||||
function getImportCode(imports, options) {
|
||||
let code = "";
|
||||
|
||||
for (const item of imports) {
|
||||
const {
|
||||
importName,
|
||||
url,
|
||||
icss
|
||||
} = item;
|
||||
|
||||
if (options.esModule) {
|
||||
if (icss && options.modules.namedExport) {
|
||||
code += `import ${options.modules.exportOnlyLocals ? "" : `${importName}, `}* as ${importName}_NAMED___ from ${url};\n`;
|
||||
} else {
|
||||
code += `import ${importName} from ${url};\n`;
|
||||
}
|
||||
} else {
|
||||
code += `var ${importName} = require(${url});\n`;
|
||||
}
|
||||
}
|
||||
|
||||
return code ? `// Imports\n${code}` : "";
|
||||
}
|
||||
|
||||
function normalizeSourceMapForRuntime(map, loaderContext) {
|
||||
const resultMap = map ? map.toJSON() : null;
|
||||
|
||||
if (resultMap) {
|
||||
delete resultMap.file;
|
||||
resultMap.sourceRoot = "";
|
||||
resultMap.sources = resultMap.sources.map(source => {
|
||||
// Non-standard syntax from `postcss`
|
||||
if (source.indexOf("<") === 0) {
|
||||
return source;
|
||||
}
|
||||
|
||||
const sourceType = getURLType(source);
|
||||
|
||||
if (sourceType !== "path-relative") {
|
||||
return source;
|
||||
}
|
||||
|
||||
const resourceDirname = _path.default.dirname(loaderContext.resourcePath);
|
||||
|
||||
const absoluteSource = _path.default.resolve(resourceDirname, source);
|
||||
|
||||
const contextifyPath = normalizePath(_path.default.relative(loaderContext.rootContext, absoluteSource));
|
||||
return `webpack://./${contextifyPath}`;
|
||||
});
|
||||
}
|
||||
|
||||
return JSON.stringify(resultMap);
|
||||
}
|
||||
|
||||
function getModuleCode(result, api, replacements, options, loaderContext) {
|
||||
if (options.modules.exportOnlyLocals === true) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const sourceMapValue = options.sourceMap ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}` : "";
|
||||
let code = JSON.stringify(result.css);
|
||||
let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${options.sourceMap ? "___CSS_LOADER_API_SOURCEMAP_IMPORT___" : "function(i){return i[1]}"});\n`;
|
||||
|
||||
for (const item of api) {
|
||||
const {
|
||||
url,
|
||||
media,
|
||||
dedupe
|
||||
} = item;
|
||||
beforeCode += url ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${url});`)}${media ? `, ${JSON.stringify(media)}` : ""}]);\n` : `___CSS_LOADER_EXPORT___.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ""}${dedupe ? ", true" : ""});\n`;
|
||||
}
|
||||
|
||||
for (const item of replacements) {
|
||||
const {
|
||||
replacementName,
|
||||
importName,
|
||||
localName
|
||||
} = item;
|
||||
|
||||
if (localName) {
|
||||
code = code.replace(new RegExp(replacementName, "g"), () => options.modules.namedExport ? `" + ${importName}_NAMED___[${JSON.stringify(getValidLocalName(localName, options.modules.exportLocalsConvention))}] + "` : `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
|
||||
} else {
|
||||
const {
|
||||
hash,
|
||||
needQuotes
|
||||
} = item;
|
||||
const getUrlOptions = [].concat(hash ? [`hash: ${JSON.stringify(hash)}`] : []).concat(needQuotes ? "needQuotes: true" : []);
|
||||
const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(", ")} }` : "";
|
||||
beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
|
||||
code = code.replace(new RegExp(replacementName, "g"), () => `" + ${replacementName} + "`);
|
||||
}
|
||||
}
|
||||
|
||||
return `${beforeCode}// Module\n___CSS_LOADER_EXPORT___.push([module.id, ${code}, ""${sourceMapValue}]);\n`;
|
||||
}
|
||||
|
||||
function dashesCamelCase(str) {
|
||||
return str.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
|
||||
}
|
||||
|
||||
function getExportCode(exports, replacements, needToUseIcssPlugin, options) {
|
||||
let code = "// Exports\n";
|
||||
|
||||
if (!needToUseIcssPlugin) {
|
||||
code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
|
||||
return code;
|
||||
}
|
||||
|
||||
let localsCode = "";
|
||||
|
||||
const addExportToLocalsCode = (name, value) => {
|
||||
if (options.modules.namedExport) {
|
||||
localsCode += `export var ${name} = ${JSON.stringify(value)};\n`;
|
||||
} else {
|
||||
if (localsCode) {
|
||||
localsCode += `,\n`;
|
||||
}
|
||||
|
||||
localsCode += `\t${JSON.stringify(name)}: ${JSON.stringify(value)}`;
|
||||
}
|
||||
};
|
||||
|
||||
for (const {
|
||||
name,
|
||||
value
|
||||
} of exports) {
|
||||
switch (options.modules.exportLocalsConvention) {
|
||||
case "camelCase":
|
||||
{
|
||||
addExportToLocalsCode(name, value);
|
||||
const modifiedName = camelCase(name);
|
||||
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "camelCaseOnly":
|
||||
{
|
||||
addExportToLocalsCode(camelCase(name), value);
|
||||
break;
|
||||
}
|
||||
|
||||
case "dashes":
|
||||
{
|
||||
addExportToLocalsCode(name, value);
|
||||
const modifiedName = dashesCamelCase(name);
|
||||
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "dashesOnly":
|
||||
{
|
||||
addExportToLocalsCode(dashesCamelCase(name), value);
|
||||
break;
|
||||
}
|
||||
|
||||
case "asIs":
|
||||
default:
|
||||
addExportToLocalsCode(name, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of replacements) {
|
||||
const {
|
||||
replacementName,
|
||||
localName
|
||||
} = item;
|
||||
|
||||
if (localName) {
|
||||
const {
|
||||
importName
|
||||
} = item;
|
||||
localsCode = localsCode.replace(new RegExp(replacementName, "g"), () => {
|
||||
if (options.modules.namedExport) {
|
||||
return `" + ${importName}_NAMED___[${JSON.stringify(getValidLocalName(localName, options.modules.exportLocalsConvention))}] + "`;
|
||||
} else if (options.modules.exportOnlyLocals) {
|
||||
return `" + ${importName}[${JSON.stringify(localName)}] + "`;
|
||||
}
|
||||
|
||||
return `" + ${importName}.locals[${JSON.stringify(localName)}] + "`;
|
||||
});
|
||||
} else {
|
||||
localsCode = localsCode.replace(new RegExp(replacementName, "g"), () => `" + ${replacementName} + "`);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
code += options.modules.namedExport ? localsCode : `${options.esModule ? "export default" : "module.exports ="} {\n${localsCode}\n};\n`;
|
||||
return code;
|
||||
}
|
||||
|
||||
code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {${localsCode ? `\n${localsCode}\n` : ""}};\n`;
|
||||
code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
|
||||
return code;
|
||||
}
|
||||
|
||||
async function resolveRequests(resolve, context, possibleRequests) {
|
||||
return resolve(context, possibleRequests[0]).then(result => result).catch(error => {
|
||||
const [, ...tailPossibleRequests] = possibleRequests;
|
||||
|
||||
if (tailPossibleRequests.length === 0) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return resolveRequests(resolve, context, tailPossibleRequests);
|
||||
});
|
||||
}
|
||||
|
||||
function isUrlRequestable(url) {
|
||||
// Protocol-relative URLs
|
||||
if (/^\/\//.test(url)) {
|
||||
return false;
|
||||
} // `file:` protocol
|
||||
|
||||
|
||||
if (/^file:/i.test(url)) {
|
||||
return true;
|
||||
} // Absolute URLs
|
||||
|
||||
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !NATIVE_WIN32_PATH.test(url)) {
|
||||
return false;
|
||||
} // `#` URLs
|
||||
|
||||
|
||||
if (/^#/.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function sort(a, b) {
|
||||
return a.index - b.index;
|
||||
}
|
||||
|
||||
function combineRequests(preRequest, url) {
|
||||
const idx = url.indexOf("!=!");
|
||||
return idx !== -1 ? url.slice(0, idx + 3) + preRequest + url.slice(idx + 3) : preRequest + url;
|
||||
}
|
1
node_modules/css-loader/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/css-loader/node_modules/.bin/semver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
340
node_modules/css-loader/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
340
node_modules/css-loader/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,340 @@
|
||||
# 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.
|
||||
|
||||
## [3.3.0](https://github.com/webpack/schema-utils/compare/v3.2.0...v3.3.0) (2023-06-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added API to disable and enable validation ([#183](https://github.com/webpack/schema-utils/issues/183)) ([d4d334f](https://github.com/webpack/schema-utils/commit/d4d334f0ba22eb6b6564b1119e8f3ea439e1f2bb))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **perf:** cache compiled schema ([#182](https://github.com/webpack/schema-utils/issues/182)) ([02aa068](https://github.com/webpack/schema-utils/commit/02aa068df80d99cc576a5ed385f947eb5204c5db))
|
||||
|
||||
## [3.2.0](https://github.com/webpack/schema-utils/compare/v3.1.2...v3.2.0) (2023-06-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* implement `undefinedAsNull` keyword for `enum` type ([#176](https://github.com/webpack/schema-utils/issues/176)) ([95826eb](https://github.com/webpack/schema-utils/commit/95826eb9e14bc4b10ab95f962ac2bdca447880a3))
|
||||
|
||||
### [3.1.2](https://github.com/webpack/schema-utils/compare/v3.1.1...v3.1.2) (2023-04-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **perf:** reduced initial start time ([#170](https://github.com/webpack/schema-utils/issues/170)) ([8d052e6](https://github.com/webpack/schema-utils/commit/8d052e6764dc9247e7d5b7b1ae8f87ca5047b2b0))
|
||||
|
||||
### [3.1.1](https://github.com/webpack/schema-utils/compare/v3.1.0...v3.1.1) (2021-07-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update error message for `integer` ([#136](https://github.com/webpack/schema-utils/issues/136)) ([2daa97e](https://github.com/webpack/schema-utils/commit/2daa97eae87e6790b92711746a6a527b859ac13b))
|
||||
|
||||
## [3.1.0](https://github.com/webpack/schema-utils/compare/v3.0.0...v3.1.0) (2021-06-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added the `link` property in validation error ([589aa59](https://github.com/webpack/schema-utils/commit/589aa5993424a8bc45ec22b67dff55be92c456a9))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* non-empty validation error message ([#116](https://github.com/webpack/schema-utils/issues/116)) ([c51abef](https://github.com/webpack/schema-utils/commit/c51abefa4d4d62e1346b3a105182d36675595077))
|
||||
|
||||
## [3.0.0](https://github.com/webpack/schema-utils/compare/v2.7.1...v3.0.0) (2020-10-05)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* minimum supported `Node.js` version is `10.13.0`,
|
||||
* the packages exports was changed, please use `const { validate } = require('schema-utils');`
|
||||
* the `ValidateError` export was removed in favor the `ValidationError` export, please use `const { ValidationError } = require('schema-utils');`
|
||||
|
||||
### [2.7.1](https://github.com/webpack/schema-utils/compare/v2.7.0...v2.7.1) (2020-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove esModuleInterop from tsconfig ([#110](https://github.com/webpack/schema-utils/issues/110)) ([#111](https://github.com/webpack/schema-utils/issues/111)) ([2f40154](https://github.com/webpack/schema-utils/commit/2f40154b91e45b393258ae9dd8f10cc3b8590b7d))
|
||||
|
||||
## [2.7.0](https://github.com/webpack/schema-utils/compare/v2.6.6...v2.7.0) (2020-05-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve hints ([a36e535](https://github.com/webpack/schema-utils/commit/a36e535faca1b01e27c3bfa3c8bee9227c3f836c))
|
||||
* smart not case ([#101](https://github.com/webpack/schema-utils/issues/101)) ([698d8b0](https://github.com/webpack/schema-utils/commit/698d8b05462d86aadb217e25a45c7b953a79a52e))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* move @types/json-schema from devDependencies to dependencies ([#97](https://github.com/webpack/schema-utils/issues/97)) ([#98](https://github.com/webpack/schema-utils/issues/98)) ([945e67d](https://github.com/webpack/schema-utils/commit/945e67db5e19baf7ec7df72813b0739dd56f950d))
|
||||
|
||||
### [2.6.6](https://github.com/webpack/schema-utils/compare/v2.6.5...v2.6.6) (2020-04-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* improve perf
|
||||
|
||||
### [2.6.5](https://github.com/webpack/schema-utils/compare/v2.6.4...v2.6.5) (2020-03-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct dots at end of sentence ([7284beb](https://github.com/webpack/schema-utils/commit/7284bebe00cd570f1bef2c15951a07b9794038e6))
|
||||
|
||||
### [2.6.4](https://github.com/webpack/schema-utils/compare/v2.6.3...v2.6.4) (2020-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change `initialised` to `initialized` ([#87](https://github.com/webpack/schema-utils/issues/87)) ([70f12d3](https://github.com/webpack/schema-utils/commit/70f12d33a8eaa27249bc9c1a27f886724cf91ea7))
|
||||
|
||||
### [2.6.3](https://github.com/webpack/schema-utils/compare/v2.6.2...v2.6.3) (2020-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* prefer the `baseDataPath` option from arguments ([#86](https://github.com/webpack/schema-utils/issues/86)) ([e236859](https://github.com/webpack/schema-utils/commit/e236859e85b28e35e1294f86fc1ff596a5031cea))
|
||||
|
||||
### [2.6.2](https://github.com/webpack/schema-utils/compare/v2.6.1...v2.6.2) (2020-01-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better handle Windows absolute paths ([#85](https://github.com/webpack/schema-utils/issues/85)) ([1fa2930](https://github.com/webpack/schema-utils/commit/1fa2930a161e907b9fc53a7233d605910afdb883))
|
||||
|
||||
### [2.6.1](https://github.com/webpack/schema-utils/compare/v2.6.0...v2.6.1) (2019-11-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* typescript declarations ([#84](https://github.com/webpack/schema-utils/issues/84)) ([89d55a9](https://github.com/webpack/schema-utils/commit/89d55a9a8edfa6a8ac8b112f226bb3154e260319))
|
||||
|
||||
## [2.6.0](https://github.com/webpack/schema-utils/compare/v2.5.0...v2.6.0) (2019-11-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support configuration via title ([#81](https://github.com/webpack/schema-utils/issues/81)) ([afddc10](https://github.com/webpack/schema-utils/commit/afddc109f6891cd37a9f1835d50862d119a072bf))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* typescript definitions ([#70](https://github.com/webpack/schema-utils/issues/70)) ([f38158d](https://github.com/webpack/schema-utils/commit/f38158d6d040e2c701622778ae8122fb26a4f990))
|
||||
|
||||
## [2.5.0](https://github.com/webpack/schema-utils/compare/v2.4.1...v2.5.0) (2019-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* rework format for maxLength, minLength ([#67](https://github.com/webpack/schema-utils/issues/67)) ([0d12259](https://github.com/webpack/schema-utils/commit/0d12259))
|
||||
* support all cases with one number in range ([#64](https://github.com/webpack/schema-utils/issues/64)) ([7fc8069](https://github.com/webpack/schema-utils/commit/7fc8069))
|
||||
* typescript definition and export naming ([#69](https://github.com/webpack/schema-utils/issues/69)) ([a435b79](https://github.com/webpack/schema-utils/commit/a435b79))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* "smart" numbers range ([62fb107](https://github.com/webpack/schema-utils/commit/62fb107))
|
||||
|
||||
### [2.4.1](https://github.com/webpack/schema-utils/compare/v2.4.0...v2.4.1) (2019-09-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* publish definitions ([#58](https://github.com/webpack/schema-utils/issues/58)) ([1885faa](https://github.com/webpack/schema-utils/commit/1885faa))
|
||||
|
||||
## [2.4.0](https://github.com/webpack/schema-utils/compare/v2.3.0...v2.4.0) (2019-09-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* better errors when the `type` keyword doesn't exist ([0988be2](https://github.com/webpack/schema-utils/commit/0988be2))
|
||||
* support $data reference ([#56](https://github.com/webpack/schema-utils/issues/56)) ([d2f11d6](https://github.com/webpack/schema-utils/commit/d2f11d6))
|
||||
* types definitions ([#52](https://github.com/webpack/schema-utils/issues/52)) ([facb431](https://github.com/webpack/schema-utils/commit/facb431))
|
||||
|
||||
## [2.3.0](https://github.com/webpack/schema-utils/compare/v2.2.0...v2.3.0) (2019-09-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support `not` keyword ([#53](https://github.com/webpack/schema-utils/issues/53)) ([765f458](https://github.com/webpack/schema-utils/commit/765f458))
|
||||
|
||||
## [2.2.0](https://github.com/webpack/schema-utils/compare/v2.1.0...v2.2.0) (2019-09-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* better error output for `oneOf` and `anyOf` ([#48](https://github.com/webpack/schema-utils/issues/48)) ([#50](https://github.com/webpack/schema-utils/issues/50)) ([332242f](https://github.com/webpack/schema-utils/commit/332242f))
|
||||
|
||||
## [2.1.0](https://github.com/webpack-contrib/schema-utils/compare/v2.0.1...v2.1.0) (2019-08-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* throw error on sparse arrays ([#47](https://github.com/webpack-contrib/schema-utils/issues/47)) ([b85ac38](https://github.com/webpack-contrib/schema-utils/commit/b85ac38))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* export `ValidateError` ([#46](https://github.com/webpack-contrib/schema-utils/issues/46)) ([ff781d7](https://github.com/webpack-contrib/schema-utils/commit/ff781d7))
|
||||
|
||||
|
||||
|
||||
### [2.0.1](https://github.com/webpack-contrib/schema-utils/compare/v2.0.0...v2.0.1) (2019-07-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* error message for empty object ([#44](https://github.com/webpack-contrib/schema-utils/issues/44)) ([0b4b4a2](https://github.com/webpack-contrib/schema-utils/commit/0b4b4a2))
|
||||
|
||||
|
||||
|
||||
### [2.0.0](https://github.com/webpack-contrib/schema-utils/compare/v1.0.0...v2.0.0) (2019-07-17)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* drop support for Node.js < 8.9.0
|
||||
* drop support `errorMessage`, please use `description` for links.
|
||||
* api was changed, please look documentation.
|
||||
* error messages was fully rewritten.
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.7"></a>
|
||||
## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.6"></a>
|
||||
## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81))
|
||||
* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.5"></a>
|
||||
## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f))
|
||||
* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.4"></a>
|
||||
## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.3"></a>
|
||||
## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda))
|
||||
* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.2"></a>
|
||||
## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.1"></a>
|
||||
## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.0"></a>
|
||||
# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816))
|
||||
|
||||
|
||||
|
||||
<a name="0.3.0"></a>
|
||||
# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb))
|
||||
|
||||
|
||||
|
||||
<a name="0.2.1"></a>
|
||||
## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363))
|
||||
* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f))
|
||||
|
||||
|
||||
|
||||
<a name="0.2.0"></a>
|
||||
# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12)
|
||||
|
||||
<a name="0.1.0"></a>
|
||||
# 0.1.0 (2017-03-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b))
|
||||
|
||||
|
||||
|
||||
# Change Log
|
||||
|
||||
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.
|
20
node_modules/css-loader/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
20
node_modules/css-loader/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright JS Foundation and other contributors
|
||||
|
||||
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.
|
290
node_modules/css-loader/node_modules/schema-utils/README.md
generated
vendored
Normal file
290
node_modules/css-loader/node_modules/schema-utils/README.md
generated
vendored
Normal file
@ -0,0 +1,290 @@
|
||||
<div align="center">
|
||||
<a href="http://json-schema.org">
|
||||
<img width="160" height="160"
|
||||
src="https://raw.githubusercontent.com/webpack-contrib/schema-utils/master/.github/assets/logo.png">
|
||||
</a>
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img width="200" height="200"
|
||||
src="https://webpack.js.org/assets/icon-square-big.svg">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![chat][chat]][chat-url]
|
||||
[![size][size]][size-url]
|
||||
|
||||
# schema-utils
|
||||
|
||||
Package for validate options in loaders and plugins.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To begin, you'll need to install `schema-utils`:
|
||||
|
||||
```console
|
||||
npm install schema-utils
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
**schema.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"option": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { option: true };
|
||||
const configuration = { name: "Loader Name/Plugin Name/Name" };
|
||||
|
||||
validate(schema, options, configuration);
|
||||
```
|
||||
|
||||
### `schema`
|
||||
|
||||
Type: `String`
|
||||
|
||||
JSON schema.
|
||||
|
||||
Simple example of schema:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "This is description of option.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
### `options`
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Object with options.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, { name: 123 }, { name: "MyPlugin" });
|
||||
```
|
||||
|
||||
### `configuration`
|
||||
|
||||
Allow to configure validator.
|
||||
|
||||
There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "My Loader options",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "This is description of option.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
The last word used for the `baseDataPath` option, other words used for the `name` option.
|
||||
Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`.
|
||||
|
||||
#### `name`
|
||||
|
||||
Type: `Object`
|
||||
Default: `"Object"`
|
||||
|
||||
Allow to setup name in validation errors.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, options, { name: "MyPlugin" });
|
||||
```
|
||||
|
||||
```shell
|
||||
Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema.
|
||||
- configuration.optionName should be a integer.
|
||||
```
|
||||
|
||||
#### `baseDataPath`
|
||||
|
||||
Type: `String`
|
||||
Default: `"configuration"`
|
||||
|
||||
Allow to setup base data path in validation errors.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, options, { name: "MyPlugin", baseDataPath: "options" });
|
||||
```
|
||||
|
||||
```shell
|
||||
Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema.
|
||||
- options.optionName should be a integer.
|
||||
```
|
||||
|
||||
#### `postFormatter`
|
||||
|
||||
Type: `Function`
|
||||
Default: `undefined`
|
||||
|
||||
Allow to reformat errors.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, options, {
|
||||
name: "MyPlugin",
|
||||
postFormatter: (formattedError, error) => {
|
||||
if (error.keyword === "type") {
|
||||
return `${formattedError}\nAdditional Information.`;
|
||||
}
|
||||
|
||||
return formattedError;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```shell
|
||||
Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema.
|
||||
- options.optionName should be a integer.
|
||||
Additional Information.
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**schema.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"test": {
|
||||
"anyOf": [
|
||||
{ "type": "array" },
|
||||
{ "type": "string" },
|
||||
{ "instanceof": "RegExp" }
|
||||
]
|
||||
},
|
||||
"transform": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"sourceMap": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
### `Loader`
|
||||
|
||||
```js
|
||||
import { getOptions } from "loader-utils";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
import schema from "path/to/schema.json";
|
||||
|
||||
function loader(src, map) {
|
||||
const options = getOptions(this);
|
||||
|
||||
validate(schema, options, {
|
||||
name: "Loader Name",
|
||||
baseDataPath: "options",
|
||||
});
|
||||
|
||||
// Code...
|
||||
}
|
||||
|
||||
export default loader;
|
||||
```
|
||||
|
||||
### `Plugin`
|
||||
|
||||
```js
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
import schema from "path/to/schema.json";
|
||||
|
||||
class Plugin {
|
||||
constructor(options) {
|
||||
validate(schema, options, {
|
||||
name: "Plugin Name",
|
||||
baseDataPath: "options",
|
||||
});
|
||||
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
// Code...
|
||||
}
|
||||
}
|
||||
|
||||
export default Plugin;
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
||||
|
||||
[CONTRIBUTING](./.github/CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/schema-utils.svg
|
||||
[npm-url]: https://npmjs.com/package/schema-utils
|
||||
[node]: https://img.shields.io/node/v/schema-utils.svg
|
||||
[node-url]: https://nodejs.org
|
||||
[deps]: https://david-dm.org/webpack/schema-utils.svg
|
||||
[deps-url]: https://david-dm.org/webpack/schema-utils
|
||||
[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg
|
||||
[tests-url]: https://github.com/webpack/schema-utils/actions
|
||||
[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg
|
||||
[cover-url]: https://codecov.io/gh/webpack/schema-utils
|
||||
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
||||
[chat-url]: https://gitter.im/webpack/webpack
|
||||
[size]: https://packagephobia.com/badge?p=schema-utils
|
||||
[size-url]: https://packagephobia.com/result?p=schema-utils
|
74
node_modules/css-loader/node_modules/schema-utils/declarations/ValidationError.d.ts
generated
vendored
Normal file
74
node_modules/css-loader/node_modules/schema-utils/declarations/ValidationError.d.ts
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
export default ValidationError;
|
||||
export type JSONSchema6 = import("json-schema").JSONSchema6;
|
||||
export type JSONSchema7 = import("json-schema").JSONSchema7;
|
||||
export type Schema = import("./validate").Schema;
|
||||
export type ValidationErrorConfiguration =
|
||||
import("./validate").ValidationErrorConfiguration;
|
||||
export type PostFormatter = import("./validate").PostFormatter;
|
||||
export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject;
|
||||
declare class ValidationError extends Error {
|
||||
/**
|
||||
* @param {Array<SchemaUtilErrorObject>} errors
|
||||
* @param {Schema} schema
|
||||
* @param {ValidationErrorConfiguration} configuration
|
||||
*/
|
||||
constructor(
|
||||
errors: Array<SchemaUtilErrorObject>,
|
||||
schema: Schema,
|
||||
configuration?: ValidationErrorConfiguration
|
||||
);
|
||||
/** @type {Array<SchemaUtilErrorObject>} */
|
||||
errors: Array<SchemaUtilErrorObject>;
|
||||
/** @type {Schema} */
|
||||
schema: Schema;
|
||||
/** @type {string} */
|
||||
headerName: string;
|
||||
/** @type {string} */
|
||||
baseDataPath: string;
|
||||
/** @type {PostFormatter | null} */
|
||||
postFormatter: PostFormatter | null;
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {Schema}
|
||||
*/
|
||||
getSchemaPart(path: string): Schema;
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {boolean} logic
|
||||
* @param {Array<Object>} prevSchemas
|
||||
* @returns {string}
|
||||
*/
|
||||
formatSchema(
|
||||
schema: Schema,
|
||||
logic?: boolean,
|
||||
prevSchemas?: Array<Object>
|
||||
): string;
|
||||
/**
|
||||
* @param {Schema=} schemaPart
|
||||
* @param {(boolean | Array<string>)=} additionalPath
|
||||
* @param {boolean=} needDot
|
||||
* @param {boolean=} logic
|
||||
* @returns {string}
|
||||
*/
|
||||
getSchemaPartText(
|
||||
schemaPart?: Schema | undefined,
|
||||
additionalPath?: (boolean | Array<string>) | undefined,
|
||||
needDot?: boolean | undefined,
|
||||
logic?: boolean | undefined
|
||||
): string;
|
||||
/**
|
||||
* @param {Schema=} schemaPart
|
||||
* @returns {string}
|
||||
*/
|
||||
getSchemaPartDescription(schemaPart?: Schema | undefined): string;
|
||||
/**
|
||||
* @param {SchemaUtilErrorObject} error
|
||||
* @returns {string}
|
||||
*/
|
||||
formatValidationError(error: SchemaUtilErrorObject): string;
|
||||
/**
|
||||
* @param {Array<SchemaUtilErrorObject>} errors
|
||||
* @returns {string}
|
||||
*/
|
||||
formatValidationErrors(errors: Array<SchemaUtilErrorObject>): string;
|
||||
}
|
12
node_modules/css-loader/node_modules/schema-utils/declarations/index.d.ts
generated
vendored
Normal file
12
node_modules/css-loader/node_modules/schema-utils/declarations/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { validate } from "./validate";
|
||||
import { ValidationError } from "./validate";
|
||||
import { enableValidation } from "./validate";
|
||||
import { disableValidation } from "./validate";
|
||||
import { needValidate } from "./validate";
|
||||
export {
|
||||
validate,
|
||||
ValidationError,
|
||||
enableValidation,
|
||||
disableValidation,
|
||||
needValidate,
|
||||
};
|
10
node_modules/css-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts
generated
vendored
Normal file
10
node_modules/css-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export default addAbsolutePathKeyword;
|
||||
export type Ajv = import("ajv").Ajv;
|
||||
export type ValidateFunction = import("ajv").ValidateFunction;
|
||||
export type SchemaUtilErrorObject = import("../validate").SchemaUtilErrorObject;
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @returns {Ajv}
|
||||
*/
|
||||
declare function addAbsolutePathKeyword(ajv: Ajv): Ajv;
|
8
node_modules/css-loader/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts
generated
vendored
Normal file
8
node_modules/css-loader/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
export default addUndefinedAsNullKeyword;
|
||||
export type Ajv = import("ajv").Ajv;
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @returns {Ajv}
|
||||
*/
|
||||
declare function addUndefinedAsNullKeyword(ajv: Ajv): Ajv;
|
79
node_modules/css-loader/node_modules/schema-utils/declarations/util/Range.d.ts
generated
vendored
Normal file
79
node_modules/css-loader/node_modules/schema-utils/declarations/util/Range.d.ts
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
export = Range;
|
||||
/**
|
||||
* @typedef {[number, boolean]} RangeValue
|
||||
*/
|
||||
/**
|
||||
* @callback RangeValueCallback
|
||||
* @param {RangeValue} rangeValue
|
||||
* @returns {boolean}
|
||||
*/
|
||||
declare class Range {
|
||||
/**
|
||||
* @param {"left" | "right"} side
|
||||
* @param {boolean} exclusive
|
||||
* @returns {">" | ">=" | "<" | "<="}
|
||||
*/
|
||||
static getOperator(
|
||||
side: "left" | "right",
|
||||
exclusive: boolean
|
||||
): ">" | ">=" | "<" | "<=";
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @param {boolean} exclusive is range exclusive
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatRight(value: number, logic: boolean, exclusive: boolean): string;
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @param {boolean} exclusive is range exclusive
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatLeft(value: number, logic: boolean, exclusive: boolean): string;
|
||||
/**
|
||||
* @param {number} start left side value
|
||||
* @param {number} end right side value
|
||||
* @param {boolean} startExclusive is range exclusive from left side
|
||||
* @param {boolean} endExclusive is range exclusive from right side
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatRange(
|
||||
start: number,
|
||||
end: number,
|
||||
startExclusive: boolean,
|
||||
endExclusive: boolean,
|
||||
logic: boolean
|
||||
): string;
|
||||
/**
|
||||
* @param {Array<RangeValue>} values
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @return {RangeValue} computed value and it's exclusive flag
|
||||
*/
|
||||
static getRangeValue(values: Array<RangeValue>, logic: boolean): RangeValue;
|
||||
/** @type {Array<RangeValue>} */
|
||||
_left: Array<RangeValue>;
|
||||
/** @type {Array<RangeValue>} */
|
||||
_right: Array<RangeValue>;
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} exclusive
|
||||
*/
|
||||
left(value: number, exclusive?: boolean | undefined): void;
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} exclusive
|
||||
*/
|
||||
right(value: number, exclusive?: boolean | undefined): void;
|
||||
/**
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @return {string} "smart" range string representation
|
||||
*/
|
||||
format(logic?: boolean): string;
|
||||
}
|
||||
declare namespace Range {
|
||||
export { RangeValue, RangeValueCallback };
|
||||
}
|
||||
type RangeValue = [number, boolean];
|
||||
type RangeValueCallback = (rangeValue: RangeValue) => boolean;
|
3
node_modules/css-loader/node_modules/schema-utils/declarations/util/hints.d.ts
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/schema-utils/declarations/util/hints.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export function stringHints(schema: Schema, logic: boolean): string[];
|
||||
export function numberHints(schema: Schema, logic: boolean): string[];
|
||||
export type Schema = import("../validate").Schema;
|
42
node_modules/css-loader/node_modules/schema-utils/declarations/validate.d.ts
generated
vendored
Normal file
42
node_modules/css-loader/node_modules/schema-utils/declarations/validate.d.ts
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
export type JSONSchema4 = import("json-schema").JSONSchema4;
|
||||
export type JSONSchema6 = import("json-schema").JSONSchema6;
|
||||
export type JSONSchema7 = import("json-schema").JSONSchema7;
|
||||
export type ErrorObject = import("ajv").ErrorObject;
|
||||
export type ValidateFunction = import("ajv").ValidateFunction;
|
||||
export type Extend = {
|
||||
formatMinimum?: number | undefined;
|
||||
formatMaximum?: number | undefined;
|
||||
formatExclusiveMinimum?: boolean | undefined;
|
||||
formatExclusiveMaximum?: boolean | undefined;
|
||||
link?: string | undefined;
|
||||
undefinedAsNull?: boolean | undefined;
|
||||
};
|
||||
export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend;
|
||||
export type SchemaUtilErrorObject = ErrorObject & {
|
||||
children?: Array<ErrorObject>;
|
||||
};
|
||||
export type PostFormatter = (
|
||||
formattedError: string,
|
||||
error: SchemaUtilErrorObject
|
||||
) => string;
|
||||
export type ValidationErrorConfiguration = {
|
||||
name?: string | undefined;
|
||||
baseDataPath?: string | undefined;
|
||||
postFormatter?: PostFormatter | undefined;
|
||||
};
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {Array<object> | object} options
|
||||
* @param {ValidationErrorConfiguration=} configuration
|
||||
* @returns {void}
|
||||
*/
|
||||
export function validate(
|
||||
schema: Schema,
|
||||
options: Array<object> | object,
|
||||
configuration?: ValidationErrorConfiguration | undefined
|
||||
): void;
|
||||
export function enableValidation(): void;
|
||||
export function disableValidation(): void;
|
||||
export function needValidate(): boolean;
|
||||
import ValidationError from "./ValidationError";
|
||||
export { ValidationError };
|
1277
node_modules/css-loader/node_modules/schema-utils/dist/ValidationError.js
generated
vendored
Normal file
1277
node_modules/css-loader/node_modules/schema-utils/dist/ValidationError.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17
node_modules/css-loader/node_modules/schema-utils/dist/index.js
generated
vendored
Normal file
17
node_modules/css-loader/node_modules/schema-utils/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
validate,
|
||||
ValidationError,
|
||||
enableValidation,
|
||||
disableValidation,
|
||||
needValidate
|
||||
} = require("./validate");
|
||||
|
||||
module.exports = {
|
||||
validate,
|
||||
ValidationError,
|
||||
enableValidation,
|
||||
disableValidation,
|
||||
needValidate
|
||||
};
|
93
node_modules/css-loader/node_modules/schema-utils/dist/keywords/absolutePath.js
generated
vendored
Normal file
93
node_modules/css-loader/node_modules/schema-utils/dist/keywords/absolutePath.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/** @typedef {import("ajv").Ajv} Ajv */
|
||||
|
||||
/** @typedef {import("ajv").ValidateFunction} ValidateFunction */
|
||||
|
||||
/** @typedef {import("../validate").SchemaUtilErrorObject} SchemaUtilErrorObject */
|
||||
|
||||
/**
|
||||
* @param {string} message
|
||||
* @param {object} schema
|
||||
* @param {string} data
|
||||
* @returns {SchemaUtilErrorObject}
|
||||
*/
|
||||
function errorMessage(message, schema, data) {
|
||||
return {
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line no-undefined
|
||||
dataPath: undefined,
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line no-undefined
|
||||
schemaPath: undefined,
|
||||
keyword: "absolutePath",
|
||||
params: {
|
||||
absolutePath: data
|
||||
},
|
||||
message,
|
||||
parentSchema: schema
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {boolean} shouldBeAbsolute
|
||||
* @param {object} schema
|
||||
* @param {string} data
|
||||
* @returns {SchemaUtilErrorObject}
|
||||
*/
|
||||
|
||||
|
||||
function getErrorFor(shouldBeAbsolute, schema, data) {
|
||||
const message = shouldBeAbsolute ? `The provided value ${JSON.stringify(data)} is not an absolute path!` : `A relative path is expected. However, the provided value ${JSON.stringify(data)} is an absolute path!`;
|
||||
return errorMessage(message, schema, data);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @returns {Ajv}
|
||||
*/
|
||||
|
||||
|
||||
function addAbsolutePathKeyword(ajv) {
|
||||
ajv.addKeyword("absolutePath", {
|
||||
errors: true,
|
||||
type: "string",
|
||||
|
||||
compile(schema, parentSchema) {
|
||||
/** @type {ValidateFunction} */
|
||||
const callback = data => {
|
||||
let passes = true;
|
||||
const isExclamationMarkPresent = data.includes("!");
|
||||
|
||||
if (isExclamationMarkPresent) {
|
||||
callback.errors = [errorMessage(`The provided value ${JSON.stringify(data)} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`, parentSchema, data)];
|
||||
passes = false;
|
||||
} // ?:[A-Za-z]:\\ - Windows absolute path
|
||||
// \\\\ - Windows network absolute path
|
||||
// \/ - Unix-like OS absolute path
|
||||
|
||||
|
||||
const isCorrectAbsolutePath = schema === /^(?:[A-Za-z]:(\\|\/)|\\\\|\/)/.test(data);
|
||||
|
||||
if (!isCorrectAbsolutePath) {
|
||||
callback.errors = [getErrorFor(schema, parentSchema, data)];
|
||||
passes = false;
|
||||
}
|
||||
|
||||
return passes;
|
||||
};
|
||||
|
||||
callback.errors = [];
|
||||
return callback;
|
||||
}
|
||||
|
||||
});
|
||||
return ajv;
|
||||
}
|
||||
|
||||
var _default = addAbsolutePathKeyword;
|
||||
exports.default = _default;
|
95
node_modules/css-loader/node_modules/schema-utils/dist/keywords/undefinedAsNull.js
generated
vendored
Normal file
95
node_modules/css-loader/node_modules/schema-utils/dist/keywords/undefinedAsNull.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/** @typedef {import("ajv").Ajv} Ajv */
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @param {string} keyword
|
||||
* @param {any} definition
|
||||
*/
|
||||
function addKeyword(ajv, keyword, definition) {
|
||||
let customRuleCode;
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line global-require
|
||||
customRuleCode = require("ajv/lib/dotjs/custom"); // @ts-ignore
|
||||
|
||||
const {
|
||||
RULES
|
||||
} = ajv;
|
||||
let ruleGroup;
|
||||
|
||||
for (let i = 0; i < RULES.length; i++) {
|
||||
const rg = RULES[i];
|
||||
|
||||
if (typeof rg.type === "undefined") {
|
||||
ruleGroup = rg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const rule = {
|
||||
keyword,
|
||||
definition,
|
||||
custom: true,
|
||||
code: customRuleCode,
|
||||
implements: definition.implements
|
||||
};
|
||||
ruleGroup.rules.unshift(rule);
|
||||
RULES.custom[keyword] = rule;
|
||||
RULES.keywords[keyword] = true;
|
||||
RULES.all[keyword] = true;
|
||||
} catch (e) {// Nothing, fallback
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @returns {Ajv}
|
||||
*/
|
||||
|
||||
|
||||
function addUndefinedAsNullKeyword(ajv) {
|
||||
// There is workaround for old versions of ajv, where `before` is not implemented
|
||||
addKeyword(ajv, "undefinedAsNull", {
|
||||
modifying: true,
|
||||
|
||||
/**
|
||||
* @param {boolean} kwVal
|
||||
* @param {unknown} data
|
||||
* @param {any} parentSchema
|
||||
* @param {string} dataPath
|
||||
* @param {unknown} parentData
|
||||
* @param {number | string} parentDataProperty
|
||||
* @return {boolean}
|
||||
*/
|
||||
validate(kwVal, data, parentSchema, dataPath, parentData, parentDataProperty) {
|
||||
if (kwVal && parentSchema && typeof parentSchema.enum !== "undefined" && parentData && typeof parentDataProperty === "number") {
|
||||
const idx =
|
||||
/** @type {number} */
|
||||
parentDataProperty;
|
||||
const parentDataRef =
|
||||
/** @type {any[]} */
|
||||
parentData;
|
||||
|
||||
if (typeof parentDataRef[idx] === "undefined") {
|
||||
parentDataRef[idx] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
return ajv;
|
||||
}
|
||||
|
||||
var _default = addUndefinedAsNullKeyword;
|
||||
exports.default = _default;
|
163
node_modules/css-loader/node_modules/schema-utils/dist/util/Range.js
generated
vendored
Normal file
163
node_modules/css-loader/node_modules/schema-utils/dist/util/Range.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @typedef {[number, boolean]} RangeValue
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback RangeValueCallback
|
||||
* @param {RangeValue} rangeValue
|
||||
* @returns {boolean}
|
||||
*/
|
||||
class Range {
|
||||
/**
|
||||
* @param {"left" | "right"} side
|
||||
* @param {boolean} exclusive
|
||||
* @returns {">" | ">=" | "<" | "<="}
|
||||
*/
|
||||
static getOperator(side, exclusive) {
|
||||
if (side === "left") {
|
||||
return exclusive ? ">" : ">=";
|
||||
}
|
||||
|
||||
return exclusive ? "<" : "<=";
|
||||
}
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @param {boolean} exclusive is range exclusive
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
static formatRight(value, logic, exclusive) {
|
||||
if (logic === false) {
|
||||
return Range.formatLeft(value, !logic, !exclusive);
|
||||
}
|
||||
|
||||
return `should be ${Range.getOperator("right", exclusive)} ${value}`;
|
||||
}
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @param {boolean} exclusive is range exclusive
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
static formatLeft(value, logic, exclusive) {
|
||||
if (logic === false) {
|
||||
return Range.formatRight(value, !logic, !exclusive);
|
||||
}
|
||||
|
||||
return `should be ${Range.getOperator("left", exclusive)} ${value}`;
|
||||
}
|
||||
/**
|
||||
* @param {number} start left side value
|
||||
* @param {number} end right side value
|
||||
* @param {boolean} startExclusive is range exclusive from left side
|
||||
* @param {boolean} endExclusive is range exclusive from right side
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
static formatRange(start, end, startExclusive, endExclusive, logic) {
|
||||
let result = "should be";
|
||||
result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `;
|
||||
result += logic ? "and" : "or";
|
||||
result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`;
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* @param {Array<RangeValue>} values
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @return {RangeValue} computed value and it's exclusive flag
|
||||
*/
|
||||
|
||||
|
||||
static getRangeValue(values, logic) {
|
||||
let minMax = logic ? Infinity : -Infinity;
|
||||
let j = -1;
|
||||
const predicate = logic ?
|
||||
/** @type {RangeValueCallback} */
|
||||
([value]) => value <= minMax :
|
||||
/** @type {RangeValueCallback} */
|
||||
([value]) => value >= minMax;
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (predicate(values[i])) {
|
||||
[minMax] = values[i];
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (j > -1) {
|
||||
return values[j];
|
||||
}
|
||||
|
||||
return [Infinity, true];
|
||||
}
|
||||
|
||||
constructor() {
|
||||
/** @type {Array<RangeValue>} */
|
||||
this._left = [];
|
||||
/** @type {Array<RangeValue>} */
|
||||
|
||||
this._right = [];
|
||||
}
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} exclusive
|
||||
*/
|
||||
|
||||
|
||||
left(value, exclusive = false) {
|
||||
this._left.push([value, exclusive]);
|
||||
}
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} exclusive
|
||||
*/
|
||||
|
||||
|
||||
right(value, exclusive = false) {
|
||||
this._right.push([value, exclusive]);
|
||||
}
|
||||
/**
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @return {string} "smart" range string representation
|
||||
*/
|
||||
|
||||
|
||||
format(logic = true) {
|
||||
const [start, leftExclusive] = Range.getRangeValue(this._left, logic);
|
||||
const [end, rightExclusive] = Range.getRangeValue(this._right, !logic);
|
||||
|
||||
if (!Number.isFinite(start) && !Number.isFinite(end)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const realStart = leftExclusive ? start + 1 : start;
|
||||
const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6
|
||||
|
||||
if (realStart === realEnd) {
|
||||
return `should be ${logic ? "" : "!"}= ${realStart}`;
|
||||
} // e.g. 4 < x < ∞
|
||||
|
||||
|
||||
if (Number.isFinite(start) && !Number.isFinite(end)) {
|
||||
return Range.formatLeft(start, logic, leftExclusive);
|
||||
} // e.g. ∞ < x < 4
|
||||
|
||||
|
||||
if (!Number.isFinite(start) && Number.isFinite(end)) {
|
||||
return Range.formatRight(end, logic, rightExclusive);
|
||||
}
|
||||
|
||||
return Range.formatRange(start, end, leftExclusive, rightExclusive, logic);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Range;
|
105
node_modules/css-loader/node_modules/schema-utils/dist/util/hints.js
generated
vendored
Normal file
105
node_modules/css-loader/node_modules/schema-utils/dist/util/hints.js
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
|
||||
const Range = require("./Range");
|
||||
/** @typedef {import("../validate").Schema} Schema */
|
||||
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {boolean} logic
|
||||
* @return {string[]}
|
||||
*/
|
||||
|
||||
|
||||
module.exports.stringHints = function stringHints(schema, logic) {
|
||||
const hints = [];
|
||||
let type = "string";
|
||||
const currentSchema = { ...schema
|
||||
};
|
||||
|
||||
if (!logic) {
|
||||
const tmpLength = currentSchema.minLength;
|
||||
const tmpFormat = currentSchema.formatMinimum;
|
||||
const tmpExclusive = currentSchema.formatExclusiveMaximum;
|
||||
currentSchema.minLength = currentSchema.maxLength;
|
||||
currentSchema.maxLength = tmpLength;
|
||||
currentSchema.formatMinimum = currentSchema.formatMaximum;
|
||||
currentSchema.formatMaximum = tmpFormat;
|
||||
currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum;
|
||||
currentSchema.formatExclusiveMinimum = !tmpExclusive;
|
||||
}
|
||||
|
||||
if (typeof currentSchema.minLength === "number") {
|
||||
if (currentSchema.minLength === 1) {
|
||||
type = "non-empty string";
|
||||
} else {
|
||||
const length = Math.max(currentSchema.minLength - 1, 0);
|
||||
hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof currentSchema.maxLength === "number") {
|
||||
if (currentSchema.maxLength === 0) {
|
||||
type = "empty string";
|
||||
} else {
|
||||
const length = currentSchema.maxLength + 1;
|
||||
hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentSchema.pattern) {
|
||||
hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`);
|
||||
}
|
||||
|
||||
if (currentSchema.format) {
|
||||
hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`);
|
||||
}
|
||||
|
||||
if (currentSchema.formatMinimum) {
|
||||
hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`);
|
||||
}
|
||||
|
||||
if (currentSchema.formatMaximum) {
|
||||
hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`);
|
||||
}
|
||||
|
||||
return [type].concat(hints);
|
||||
};
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {boolean} logic
|
||||
* @return {string[]}
|
||||
*/
|
||||
|
||||
|
||||
module.exports.numberHints = function numberHints(schema, logic) {
|
||||
const hints = [schema.type === "integer" ? "integer" : "number"];
|
||||
const range = new Range();
|
||||
|
||||
if (typeof schema.minimum === "number") {
|
||||
range.left(schema.minimum);
|
||||
}
|
||||
|
||||
if (typeof schema.exclusiveMinimum === "number") {
|
||||
range.left(schema.exclusiveMinimum, true);
|
||||
}
|
||||
|
||||
if (typeof schema.maximum === "number") {
|
||||
range.right(schema.maximum);
|
||||
}
|
||||
|
||||
if (typeof schema.exclusiveMaximum === "number") {
|
||||
range.right(schema.exclusiveMaximum, true);
|
||||
}
|
||||
|
||||
const rangeFormat = range.format(logic);
|
||||
|
||||
if (rangeFormat) {
|
||||
hints.push(rangeFormat);
|
||||
}
|
||||
|
||||
if (typeof schema.multipleOf === "number") {
|
||||
hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`);
|
||||
}
|
||||
|
||||
return hints;
|
||||
};
|
258
node_modules/css-loader/node_modules/schema-utils/dist/validate.js
generated
vendored
Normal file
258
node_modules/css-loader/node_modules/schema-utils/dist/validate.js
generated
vendored
Normal file
@ -0,0 +1,258 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validate = validate;
|
||||
exports.enableValidation = enableValidation;
|
||||
exports.disableValidation = disableValidation;
|
||||
exports.needValidate = needValidate;
|
||||
Object.defineProperty(exports, "ValidationError", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _ValidationError.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _absolutePath = _interopRequireDefault(require("./keywords/absolutePath"));
|
||||
|
||||
var _undefinedAsNull = _interopRequireDefault(require("./keywords/undefinedAsNull"));
|
||||
|
||||
var _ValidationError = _interopRequireDefault(require("./ValidationError"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param fn {(function(): any) | undefined}
|
||||
* @returns {function(): T}
|
||||
*/
|
||||
const memoize = fn => {
|
||||
let cache = false;
|
||||
/** @type {T} */
|
||||
|
||||
let result;
|
||||
return () => {
|
||||
if (cache) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result =
|
||||
/** @type {function(): any} */
|
||||
fn();
|
||||
cache = true; // Allow to clean up memory for fn
|
||||
// and all dependent resources
|
||||
// eslint-disable-next-line no-undefined, no-param-reassign
|
||||
|
||||
fn = undefined;
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
const getAjv = memoize(() => {
|
||||
// Use CommonJS require for ajv libs so TypeScript consumers aren't locked into esModuleInterop (see #110).
|
||||
// eslint-disable-next-line global-require
|
||||
const Ajv = require("ajv"); // eslint-disable-next-line global-require
|
||||
|
||||
|
||||
const ajvKeywords = require("ajv-keywords");
|
||||
|
||||
const ajv = new Ajv({
|
||||
allErrors: true,
|
||||
verbose: true,
|
||||
$data: true
|
||||
});
|
||||
ajvKeywords(ajv, ["instanceof", "formatMinimum", "formatMaximum", "patternRequired"]); // Custom keywords
|
||||
|
||||
(0, _absolutePath.default)(ajv);
|
||||
(0, _undefinedAsNull.default)(ajv);
|
||||
return ajv;
|
||||
});
|
||||
/** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */
|
||||
|
||||
/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */
|
||||
|
||||
/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */
|
||||
|
||||
/** @typedef {import("ajv").ErrorObject} ErrorObject */
|
||||
|
||||
/** @typedef {import("ajv").ValidateFunction} ValidateFunction */
|
||||
|
||||
/**
|
||||
* @typedef {Object} Extend
|
||||
* @property {number=} formatMinimum
|
||||
* @property {number=} formatMaximum
|
||||
* @property {boolean=} formatExclusiveMinimum
|
||||
* @property {boolean=} formatExclusiveMaximum
|
||||
* @property {string=} link
|
||||
* @property {boolean=} undefinedAsNull
|
||||
*/
|
||||
|
||||
/** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend} Schema */
|
||||
|
||||
/** @typedef {ErrorObject & { children?: Array<ErrorObject>}} SchemaUtilErrorObject */
|
||||
|
||||
/**
|
||||
* @callback PostFormatter
|
||||
* @param {string} formattedError
|
||||
* @param {SchemaUtilErrorObject} error
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ValidationErrorConfiguration
|
||||
* @property {string=} name
|
||||
* @property {string=} baseDataPath
|
||||
* @property {PostFormatter=} postFormatter
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {SchemaUtilErrorObject} error
|
||||
* @param {number} idx
|
||||
* @returns {SchemaUtilErrorObject}
|
||||
*/
|
||||
|
||||
function applyPrefix(error, idx) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
error.dataPath = `[${idx}]${error.dataPath}`;
|
||||
|
||||
if (error.children) {
|
||||
error.children.forEach(err => applyPrefix(err, idx));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
let skipValidation = false; // We use `process.env.SKIP_VALIDATION` because you can have multiple `schema-utils` with different version,
|
||||
// so we want to disable it globally, `process.env` doesn't supported by browsers, so we have the local `skipValidation` variables
|
||||
// Enable validation
|
||||
|
||||
function enableValidation() {
|
||||
skipValidation = false; // Disable validation for any versions
|
||||
|
||||
if (process && process.env) {
|
||||
process.env.SKIP_VALIDATION = "n";
|
||||
}
|
||||
} // Disable validation
|
||||
|
||||
|
||||
function disableValidation() {
|
||||
skipValidation = true;
|
||||
|
||||
if (process && process.env) {
|
||||
process.env.SKIP_VALIDATION = "y";
|
||||
}
|
||||
} // Check if we need to confirm
|
||||
|
||||
|
||||
function needValidate() {
|
||||
if (skipValidation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process && process.env && process.env.SKIP_VALIDATION) {
|
||||
const value = process.env.SKIP_VALIDATION.trim();
|
||||
|
||||
if (/^(?:y|yes|true|1|on)$/i.test(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^(?:n|no|false|0|off)$/i.test(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {Array<object> | object} options
|
||||
* @param {ValidationErrorConfiguration=} configuration
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
||||
function validate(schema, options, configuration) {
|
||||
if (!needValidate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let errors = [];
|
||||
|
||||
if (Array.isArray(options)) {
|
||||
for (let i = 0; i <= options.length - 1; i++) {
|
||||
errors.push(...validateObject(schema, options[i]).map(err => applyPrefix(err, i)));
|
||||
}
|
||||
} else {
|
||||
errors = validateObject(schema, options);
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new _ValidationError.default(errors, schema, configuration);
|
||||
}
|
||||
}
|
||||
/** @typedef {WeakMap<Schema, ValidateFunction>} */
|
||||
|
||||
|
||||
const schemaCache = new WeakMap();
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {Array<object> | object} options
|
||||
* @returns {Array<SchemaUtilErrorObject>}
|
||||
*/
|
||||
|
||||
function validateObject(schema, options) {
|
||||
let compiledSchema = schemaCache.get(schema);
|
||||
|
||||
if (!compiledSchema) {
|
||||
compiledSchema = getAjv().compile(schema);
|
||||
schemaCache.set(schema, compiledSchema);
|
||||
}
|
||||
|
||||
const valid = compiledSchema(options);
|
||||
if (valid) return [];
|
||||
return compiledSchema.errors ? filterErrors(compiledSchema.errors) : [];
|
||||
}
|
||||
/**
|
||||
* @param {Array<ErrorObject>} errors
|
||||
* @returns {Array<SchemaUtilErrorObject>}
|
||||
*/
|
||||
|
||||
|
||||
function filterErrors(errors) {
|
||||
/** @type {Array<SchemaUtilErrorObject>} */
|
||||
let newErrors = [];
|
||||
|
||||
for (const error of
|
||||
/** @type {Array<SchemaUtilErrorObject>} */
|
||||
errors) {
|
||||
const {
|
||||
dataPath
|
||||
} = error;
|
||||
/** @type {Array<SchemaUtilErrorObject>} */
|
||||
|
||||
let children = [];
|
||||
newErrors = newErrors.filter(oldError => {
|
||||
if (oldError.dataPath.includes(dataPath)) {
|
||||
if (oldError.children) {
|
||||
children = children.concat(oldError.children.slice(0));
|
||||
} // eslint-disable-next-line no-undefined, no-param-reassign
|
||||
|
||||
|
||||
oldError.children = undefined;
|
||||
children.push(oldError);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (children.length) {
|
||||
error.children = children;
|
||||
}
|
||||
|
||||
newErrors.push(error);
|
||||
}
|
||||
|
||||
return newErrors;
|
||||
}
|
78
node_modules/css-loader/node_modules/schema-utils/package.json
generated
vendored
Normal file
78
node_modules/css-loader/node_modules/schema-utils/package.json
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "schema-utils",
|
||||
"version": "3.3.0",
|
||||
"description": "webpack Validation Utils",
|
||||
"license": "MIT",
|
||||
"repository": "webpack/schema-utils",
|
||||
"author": "webpack Contrib (https://github.com/webpack-contrib)",
|
||||
"homepage": "https://github.com/webpack/schema-utils",
|
||||
"bugs": "https://github.com/webpack/schema-utils/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "declarations/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run build -- -w",
|
||||
"clean": "del-cli dist declarations",
|
||||
"prebuild": "npm run clean",
|
||||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write",
|
||||
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
||||
"build": "npm-run-all -p \"build:**\"",
|
||||
"commitlint": "commitlint --from=master",
|
||||
"security": "npm audit --production",
|
||||
"fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
|
||||
"lint:js": "eslint --cache .",
|
||||
"lint:types": "tsc --pretty --noEmit",
|
||||
"lint": "npm-run-all lint:js lint:types fmt:check",
|
||||
"fmt": "npm run fmt:check -- --write",
|
||||
"fix:js": "npm run lint:js -- --fix",
|
||||
"fix": "npm-run-all fix:js fmt",
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch",
|
||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:coverage",
|
||||
"prepare": "npm run build && husky install",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"declarations"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.8",
|
||||
"ajv": "^6.12.5",
|
||||
"ajv-keywords": "^3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/preset-env": "^7.14.7",
|
||||
"@commitlint/cli": "^12.1.4",
|
||||
"@commitlint/config-conventional": "^12.1.4",
|
||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
||||
"babel-jest": "^27.0.6",
|
||||
"cross-env": "^7.0.3",
|
||||
"del": "^6.0.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"eslint": "^7.31.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"husky": "^6.0.0",
|
||||
"jest": "^27.0.6",
|
||||
"lint-staged": "^11.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.3.2",
|
||||
"standard-version": "^9.3.1",
|
||||
"typescript": "^4.3.5",
|
||||
"webpack": "^5.45.1"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack"
|
||||
]
|
||||
}
|
15
node_modules/css-loader/node_modules/semver/LICENSE
generated
vendored
Normal file
15
node_modules/css-loader/node_modules/semver/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
654
node_modules/css-loader/node_modules/semver/README.md
generated
vendored
Normal file
654
node_modules/css-loader/node_modules/semver/README.md
generated
vendored
Normal file
@ -0,0 +1,654 @@
|
||||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
You can also just load the module for the function that you care about if
|
||||
you'd like to minimize your footprint.
|
||||
|
||||
```js
|
||||
// load the whole API at once in a single object
|
||||
const semver = require('semver')
|
||||
|
||||
// or just load the bits you need
|
||||
// all of them listed here, just pick and choose what you want
|
||||
|
||||
// classes
|
||||
const SemVer = require('semver/classes/semver')
|
||||
const Comparator = require('semver/classes/comparator')
|
||||
const Range = require('semver/classes/range')
|
||||
|
||||
// functions for working with versions
|
||||
const semverParse = require('semver/functions/parse')
|
||||
const semverValid = require('semver/functions/valid')
|
||||
const semverClean = require('semver/functions/clean')
|
||||
const semverInc = require('semver/functions/inc')
|
||||
const semverDiff = require('semver/functions/diff')
|
||||
const semverMajor = require('semver/functions/major')
|
||||
const semverMinor = require('semver/functions/minor')
|
||||
const semverPatch = require('semver/functions/patch')
|
||||
const semverPrerelease = require('semver/functions/prerelease')
|
||||
const semverCompare = require('semver/functions/compare')
|
||||
const semverRcompare = require('semver/functions/rcompare')
|
||||
const semverCompareLoose = require('semver/functions/compare-loose')
|
||||
const semverCompareBuild = require('semver/functions/compare-build')
|
||||
const semverSort = require('semver/functions/sort')
|
||||
const semverRsort = require('semver/functions/rsort')
|
||||
|
||||
// low-level comparators between versions
|
||||
const semverGt = require('semver/functions/gt')
|
||||
const semverLt = require('semver/functions/lt')
|
||||
const semverEq = require('semver/functions/eq')
|
||||
const semverNeq = require('semver/functions/neq')
|
||||
const semverGte = require('semver/functions/gte')
|
||||
const semverLte = require('semver/functions/lte')
|
||||
const semverCmp = require('semver/functions/cmp')
|
||||
const semverCoerce = require('semver/functions/coerce')
|
||||
|
||||
// working with ranges
|
||||
const semverSatisfies = require('semver/functions/satisfies')
|
||||
const semverMaxSatisfying = require('semver/ranges/max-satisfying')
|
||||
const semverMinSatisfying = require('semver/ranges/min-satisfying')
|
||||
const semverToComparators = require('semver/ranges/to-comparators')
|
||||
const semverMinVersion = require('semver/ranges/min-version')
|
||||
const semverValidRange = require('semver/ranges/valid')
|
||||
const semverOutside = require('semver/ranges/outside')
|
||||
const semverGtr = require('semver/ranges/gtr')
|
||||
const semverLtr = require('semver/ranges/ltr')
|
||||
const semverIntersects = require('semver/ranges/intersects')
|
||||
const semverSimplifyRange = require('semver/ranges/simplify')
|
||||
const semverRangeSubset = require('semver/ranges/subset')
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-n <0|1>
|
||||
This is the base to be used for the prerelease identifier.
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` that specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and
|
||||
would match the versions `2.0.0` and `3.1.0`, but not the versions
|
||||
`1.0.1` or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version.
|
||||
Version `3.4.5` *would* satisfy the range because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose of this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range-matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for range-matching)
|
||||
by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
#### Prerelease Identifier Base
|
||||
|
||||
The method `.inc` takes an optional parameter 'identifierBase' string
|
||||
that will let you let your prerelease number as zero-based or one-based.
|
||||
Set to `false` to omit the prerelease number altogether.
|
||||
If you do not specify this parameter, it will default to zero-based.
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta', '1')
|
||||
// '1.2.4-beta.1'
|
||||
```
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta', false)
|
||||
// '1.2.4-beta'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta -n 1
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta -n false
|
||||
1.2.4-beta
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
|
||||
`includePrerelease` is specified, in which case any version at all
|
||||
satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero element in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0-0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0-0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4-0`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0-0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0-0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0-0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0-0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0-0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose`: Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease`: Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release, options, identifier, identifierBase)`:
|
||||
Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version and then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `identifier` can be used to prefix `premajor`, `preminor`,
|
||||
`prepatch`, or `prerelease` version increments. `identifierBase`
|
||||
is the base to be used for the `prerelease` identifier.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
|
||||
are equal. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `compareLoose(v1, v2)`: Short for `compare(v1, v2, { loose: true })`.
|
||||
* `diff(v1, v2)`: Returns the difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Sorting
|
||||
|
||||
* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild`
|
||||
function.
|
||||
* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on
|
||||
the `compareBuild` function in descending order.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if the version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if the version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the range comparators intersect.
|
||||
* `simplifyRange(versions, range)`: Return a "simplified" range that
|
||||
matches the same items in the `versions` list as the range specified. Note
|
||||
that it does *not* guarantee that it would match the same versions in all
|
||||
cases, only for the set of versions provided. This is useful when
|
||||
generating ranges by joining together multiple versions with `||`
|
||||
programmatically, to provide the user with something a bit more
|
||||
ergonomic. If the provided range is shorter in string-length than the
|
||||
generated range, then that is returned.
|
||||
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
|
||||
entirely contained by the `superRange` range.
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version, options)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
If the `options.includePrerelease` flag is set, then the `coerce` result will contain
|
||||
prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2`
|
||||
will preserve prerelease `rc.1` and build `rev.2` in the result.
|
||||
|
||||
### Clean
|
||||
|
||||
* `clean(version)`: Clean a string to be a valid semver if possible
|
||||
|
||||
This will return a cleaned and trimmed semver version. If the provided
|
||||
version is not valid a null will be returned. This does not work for
|
||||
ranges.
|
||||
|
||||
ex.
|
||||
* `s.clean(' = v 2.1.5foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean(' = v 2.1.5-foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' =v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
||||
* `s.clean('~1.0.0')`: `null`
|
||||
|
||||
## Constants
|
||||
|
||||
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
|
||||
|
||||
### `RELEASE_TYPES`
|
||||
|
||||
- major
|
||||
- premajor
|
||||
- minor
|
||||
- preminor
|
||||
- patch
|
||||
- prepatch
|
||||
- prerelease
|
||||
|
||||
```
|
||||
const semver = require('semver');
|
||||
|
||||
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
|
||||
console.log('This is a valid release type!');
|
||||
} else {
|
||||
console.warn('This is NOT a valid release type!');
|
||||
}
|
||||
```
|
||||
|
||||
### `SEMVER_SPEC_VERSION`
|
||||
|
||||
2.0.0
|
||||
|
||||
```
|
||||
const semver = require('semver');
|
||||
|
||||
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
|
||||
```
|
||||
|
||||
## Exported Modules
|
||||
|
||||
<!--
|
||||
TODO: Make sure that all of these items are documented (classes aren't,
|
||||
eg), and then pull the module name into the documentation for that specific
|
||||
thing.
|
||||
-->
|
||||
|
||||
You may pull in just the part of this semver utility that you need if you
|
||||
are sensitive to packing and tree-shaking concerns. The main
|
||||
`require('semver')` export uses getter functions to lazily load the parts
|
||||
of the API that are used.
|
||||
|
||||
The following modules are available:
|
||||
|
||||
* `require('semver')`
|
||||
* `require('semver/classes')`
|
||||
* `require('semver/classes/comparator')`
|
||||
* `require('semver/classes/range')`
|
||||
* `require('semver/classes/semver')`
|
||||
* `require('semver/functions/clean')`
|
||||
* `require('semver/functions/cmp')`
|
||||
* `require('semver/functions/coerce')`
|
||||
* `require('semver/functions/compare')`
|
||||
* `require('semver/functions/compare-build')`
|
||||
* `require('semver/functions/compare-loose')`
|
||||
* `require('semver/functions/diff')`
|
||||
* `require('semver/functions/eq')`
|
||||
* `require('semver/functions/gt')`
|
||||
* `require('semver/functions/gte')`
|
||||
* `require('semver/functions/inc')`
|
||||
* `require('semver/functions/lt')`
|
||||
* `require('semver/functions/lte')`
|
||||
* `require('semver/functions/major')`
|
||||
* `require('semver/functions/minor')`
|
||||
* `require('semver/functions/neq')`
|
||||
* `require('semver/functions/parse')`
|
||||
* `require('semver/functions/patch')`
|
||||
* `require('semver/functions/prerelease')`
|
||||
* `require('semver/functions/rcompare')`
|
||||
* `require('semver/functions/rsort')`
|
||||
* `require('semver/functions/satisfies')`
|
||||
* `require('semver/functions/sort')`
|
||||
* `require('semver/functions/valid')`
|
||||
* `require('semver/ranges/gtr')`
|
||||
* `require('semver/ranges/intersects')`
|
||||
* `require('semver/ranges/ltr')`
|
||||
* `require('semver/ranges/max-satisfying')`
|
||||
* `require('semver/ranges/min-satisfying')`
|
||||
* `require('semver/ranges/min-version')`
|
||||
* `require('semver/ranges/outside')`
|
||||
* `require('semver/ranges/simplify')`
|
||||
* `require('semver/ranges/subset')`
|
||||
* `require('semver/ranges/to-comparators')`
|
||||
* `require('semver/ranges/valid')`
|
||||
|
188
node_modules/css-loader/node_modules/semver/bin/semver.js
generated
vendored
Executable file
188
node_modules/css-loader/node_modules/semver/bin/semver.js
generated
vendored
Executable file
@ -0,0 +1,188 @@
|
||||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
const argv = process.argv.slice(2)
|
||||
|
||||
let versions = []
|
||||
|
||||
const range = []
|
||||
|
||||
let inc = null
|
||||
|
||||
const version = require('../package.json').version
|
||||
|
||||
let loose = false
|
||||
|
||||
let includePrerelease = false
|
||||
|
||||
let coerce = false
|
||||
|
||||
let rtl = false
|
||||
|
||||
let identifier
|
||||
|
||||
let identifierBase
|
||||
|
||||
const semver = require('../')
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
|
||||
let reverse = false
|
||||
|
||||
let options = {}
|
||||
|
||||
const main = () => {
|
||||
if (!argv.length) {
|
||||
return help()
|
||||
}
|
||||
while (argv.length) {
|
||||
let a = argv.shift()
|
||||
const indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
const value = a.slice(indexOfEqualSign + 1)
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(value)
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-n':
|
||||
identifierBase = argv.shift()
|
||||
if (identifierBase === 'false') {
|
||||
identifierBase = false
|
||||
}
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
options = parseOptions({ loose, includePrerelease, rtl })
|
||||
|
||||
versions = versions.map((v) => {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter((v) => {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) {
|
||||
return fail()
|
||||
}
|
||||
if (inc && (versions.length !== 1 || range.length)) {
|
||||
return failInc()
|
||||
}
|
||||
|
||||
for (let i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter((v) => {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) {
|
||||
return fail()
|
||||
}
|
||||
}
|
||||
versions
|
||||
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
|
||||
.map(v => semver.clean(v, options))
|
||||
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
|
||||
.forEach(v => console.log(v))
|
||||
}
|
||||
|
||||
const failInc = () => {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
const fail = () => process.exit(1)
|
||||
|
||||
const help = () => console.log(
|
||||
`SemVer ${version}
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
-n <base>
|
||||
Base number to be used for the prerelease identifier.
|
||||
Can be either 0 or 1, or false to omit the number altogether.
|
||||
Defaults to 0.
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.`)
|
||||
|
||||
main()
|
141
node_modules/css-loader/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
141
node_modules/css-loader/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
const ANY = Symbol('SemVer ANY')
|
||||
// hoisted class for cyclic dependency
|
||||
class Comparator {
|
||||
static get ANY () {
|
||||
return ANY
|
||||
}
|
||||
|
||||
constructor (comp, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === !!options.loose) {
|
||||
return comp
|
||||
} else {
|
||||
comp = comp.value
|
||||
}
|
||||
}
|
||||
|
||||
comp = comp.trim().split(/\s+/).join(' ')
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.parse(comp)
|
||||
|
||||
if (this.semver === ANY) {
|
||||
this.value = ''
|
||||
} else {
|
||||
this.value = this.operator + this.semver.version
|
||||
}
|
||||
|
||||
debug('comp', this)
|
||||
}
|
||||
|
||||
parse (comp) {
|
||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
const m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid comparator: ${comp}`)
|
||||
}
|
||||
|
||||
this.operator = m[1] !== undefined ? m[1] : ''
|
||||
if (this.operator === '=') {
|
||||
this.operator = ''
|
||||
}
|
||||
|
||||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2]) {
|
||||
this.semver = ANY
|
||||
} else {
|
||||
this.semver = new SemVer(m[2], this.options.loose)
|
||||
}
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.value
|
||||
}
|
||||
|
||||
test (version) {
|
||||
debug('Comparator.test', version, this.options.loose)
|
||||
|
||||
if (this.semver === ANY || version === ANY) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options)
|
||||
}
|
||||
|
||||
intersects (comp, options) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required')
|
||||
}
|
||||
|
||||
if (this.operator === '') {
|
||||
if (this.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(comp.value, options).test(this.value)
|
||||
} else if (comp.operator === '') {
|
||||
if (comp.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(this.value, options).test(comp.semver)
|
||||
}
|
||||
|
||||
options = parseOptions(options)
|
||||
|
||||
// Special cases where nothing can possibly be lower
|
||||
if (options.includePrerelease &&
|
||||
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
||||
return false
|
||||
}
|
||||
if (!options.includePrerelease &&
|
||||
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Same direction increasing (> or >=)
|
||||
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
||||
return true
|
||||
}
|
||||
// Same direction decreasing (< or <=)
|
||||
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
||||
return true
|
||||
}
|
||||
// same SemVer and both sides are inclusive (<= or >=)
|
||||
if (
|
||||
(this.semver.version === comp.semver.version) &&
|
||||
this.operator.includes('=') && comp.operator.includes('=')) {
|
||||
return true
|
||||
}
|
||||
// opposite directions less than
|
||||
if (cmp(this.semver, '<', comp.semver, options) &&
|
||||
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
||||
return true
|
||||
}
|
||||
// opposite directions greater than
|
||||
if (cmp(this.semver, '>', comp.semver, options) &&
|
||||
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comparator
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { safeRe: re, t } = require('../internal/re')
|
||||
const cmp = require('../functions/cmp')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const Range = require('./range')
|
5
node_modules/css-loader/node_modules/semver/classes/index.js
generated
vendored
Normal file
5
node_modules/css-loader/node_modules/semver/classes/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
SemVer: require('./semver.js'),
|
||||
Range: require('./range.js'),
|
||||
Comparator: require('./comparator.js'),
|
||||
}
|
554
node_modules/css-loader/node_modules/semver/classes/range.js
generated
vendored
Normal file
554
node_modules/css-loader/node_modules/semver/classes/range.js
generated
vendored
Normal file
@ -0,0 +1,554 @@
|
||||
const SPACE_CHARACTERS = /\s+/g
|
||||
|
||||
// hoisted class for cyclic dependency
|
||||
class Range {
|
||||
constructor (range, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (range instanceof Range) {
|
||||
if (
|
||||
range.loose === !!options.loose &&
|
||||
range.includePrerelease === !!options.includePrerelease
|
||||
) {
|
||||
return range
|
||||
} else {
|
||||
return new Range(range.raw, options)
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Comparator) {
|
||||
// just put it in the set and return
|
||||
this.raw = range.value
|
||||
this.set = [[range]]
|
||||
this.formatted = undefined
|
||||
return this
|
||||
}
|
||||
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First reduce all whitespace as much as possible so we do not have to rely
|
||||
// on potentially slow regexes like \s*. This is then stored and used for
|
||||
// future error messages as well.
|
||||
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
|
||||
|
||||
// First, split on ||
|
||||
this.set = this.raw
|
||||
.split('||')
|
||||
// map the range to a 2d array of comparators
|
||||
.map(r => this.parseRange(r.trim()))
|
||||
// throw out any comparator lists that are empty
|
||||
// this generally means that it was not a valid range, which is allowed
|
||||
// in loose mode, but will still throw if the WHOLE range is invalid.
|
||||
.filter(c => c.length)
|
||||
|
||||
if (!this.set.length) {
|
||||
throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
|
||||
}
|
||||
|
||||
// if we have any that are not the null set, throw out null sets.
|
||||
if (this.set.length > 1) {
|
||||
// keep the first one, in case they're all null sets
|
||||
const first = this.set[0]
|
||||
this.set = this.set.filter(c => !isNullSet(c[0]))
|
||||
if (this.set.length === 0) {
|
||||
this.set = [first]
|
||||
} else if (this.set.length > 1) {
|
||||
// if we have any that are *, then the range is just *
|
||||
for (const c of this.set) {
|
||||
if (c.length === 1 && isAny(c[0])) {
|
||||
this.set = [c]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.formatted = undefined
|
||||
}
|
||||
|
||||
get range () {
|
||||
if (this.formatted === undefined) {
|
||||
this.formatted = ''
|
||||
for (let i = 0; i < this.set.length; i++) {
|
||||
if (i > 0) {
|
||||
this.formatted += '||'
|
||||
}
|
||||
const comps = this.set[i]
|
||||
for (let k = 0; k < comps.length; k++) {
|
||||
if (k > 0) {
|
||||
this.formatted += ' '
|
||||
}
|
||||
this.formatted += comps[k].toString().trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.formatted
|
||||
}
|
||||
|
||||
format () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
parseRange (range) {
|
||||
// memoize range parsing for performance.
|
||||
// this is a very hot path, and fully deterministic.
|
||||
const memoOpts =
|
||||
(this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
|
||||
(this.options.loose && FLAG_LOOSE)
|
||||
const memoKey = memoOpts + ':' + range
|
||||
const cached = cache.get(memoKey)
|
||||
if (cached) {
|
||||
return cached
|
||||
}
|
||||
|
||||
const loose = this.options.loose
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
|
||||
debug('hyphen replace', range)
|
||||
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range)
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
debug('tilde trim', range)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
debug('caret trim', range)
|
||||
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
let rangeList = range
|
||||
.split(' ')
|
||||
.map(comp => parseComparator(comp, this.options))
|
||||
.join(' ')
|
||||
.split(/\s+/)
|
||||
// >=0.0.0 is equivalent to *
|
||||
.map(comp => replaceGTE0(comp, this.options))
|
||||
|
||||
if (loose) {
|
||||
// in loose mode, throw out any that are not valid comparators
|
||||
rangeList = rangeList.filter(comp => {
|
||||
debug('loose invalid filter', comp, this.options)
|
||||
return !!comp.match(re[t.COMPARATORLOOSE])
|
||||
})
|
||||
}
|
||||
debug('range list', rangeList)
|
||||
|
||||
// if any comparators are the null set, then replace with JUST null set
|
||||
// if more than one comparator, remove any * comparators
|
||||
// also, don't include the same comparator more than once
|
||||
const rangeMap = new Map()
|
||||
const comparators = rangeList.map(comp => new Comparator(comp, this.options))
|
||||
for (const comp of comparators) {
|
||||
if (isNullSet(comp)) {
|
||||
return [comp]
|
||||
}
|
||||
rangeMap.set(comp.value, comp)
|
||||
}
|
||||
if (rangeMap.size > 1 && rangeMap.has('')) {
|
||||
rangeMap.delete('')
|
||||
}
|
||||
|
||||
const result = [...rangeMap.values()]
|
||||
cache.set(memoKey, result)
|
||||
return result
|
||||
}
|
||||
|
||||
intersects (range, options) {
|
||||
if (!(range instanceof Range)) {
|
||||
throw new TypeError('a Range is required')
|
||||
}
|
||||
|
||||
return this.set.some((thisComparators) => {
|
||||
return (
|
||||
isSatisfiable(thisComparators, options) &&
|
||||
range.set.some((rangeComparators) => {
|
||||
return (
|
||||
isSatisfiable(rangeComparators, options) &&
|
||||
thisComparators.every((thisComparator) => {
|
||||
return rangeComparators.every((rangeComparator) => {
|
||||
return thisComparator.intersects(rangeComparator, options)
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// if ANY of the sets match ALL of its comparators, then pass
|
||||
test (version) {
|
||||
if (!version) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version, this.options)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Range
|
||||
|
||||
const LRU = require('../internal/lrucache')
|
||||
const cache = new LRU()
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const Comparator = require('./comparator')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const {
|
||||
safeRe: re,
|
||||
t,
|
||||
comparatorTrimReplace,
|
||||
tildeTrimReplace,
|
||||
caretTrimReplace,
|
||||
} = require('../internal/re')
|
||||
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')
|
||||
|
||||
const isNullSet = c => c.value === '<0.0.0-0'
|
||||
const isAny = c => c.value === ''
|
||||
|
||||
// take a set of comparators and determine whether there
|
||||
// exists a version which can satisfy it
|
||||
const isSatisfiable = (comparators, options) => {
|
||||
let result = true
|
||||
const remainingComparators = comparators.slice()
|
||||
let testComparator = remainingComparators.pop()
|
||||
|
||||
while (result && remainingComparators.length) {
|
||||
result = remainingComparators.every((otherComparator) => {
|
||||
return testComparator.intersects(otherComparator, options)
|
||||
})
|
||||
|
||||
testComparator = remainingComparators.pop()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||
// already replaced the hyphen ranges
|
||||
// turn into a set of JUST comparators.
|
||||
const parseComparator = (comp, options) => {
|
||||
debug('comp', comp, options)
|
||||
comp = replaceCarets(comp, options)
|
||||
debug('caret', comp)
|
||||
comp = replaceTildes(comp, options)
|
||||
debug('tildes', comp)
|
||||
comp = replaceXRanges(comp, options)
|
||||
debug('xrange', comp)
|
||||
comp = replaceStars(comp, options)
|
||||
debug('stars', comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
||||
|
||||
// ~, ~> --> * (any, kinda silly)
|
||||
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
||||
// ~0.0.1 --> >=0.0.1 <0.1.0-0
|
||||
const replaceTildes = (comp, options) => {
|
||||
return comp
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.map((c) => replaceTilde(c, options))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
const replaceTilde = (comp, options) => {
|
||||
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
// ~1.2 == >=1.2.0 <1.3.0-0
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
|
||||
} else if (pr) {
|
||||
debug('replaceTilde pr', pr)
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('tilde return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// ^ --> * (any, kinda silly)
|
||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
||||
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
||||
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
||||
const replaceCarets = (comp, options) => {
|
||||
return comp
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.map((c) => replaceCaret(c, options))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
const replaceCaret = (comp, options) => {
|
||||
debug('caret', comp, options)
|
||||
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
const z = options.includePrerelease ? '-0' : ''
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
if (M === '0') {
|
||||
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else if (pr) {
|
||||
debug('replaceCaret pr', pr)
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else {
|
||||
debug('no pr')
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
}
|
||||
|
||||
debug('caret return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
const replaceXRanges = (comp, options) => {
|
||||
debug('replaceXRanges', comp, options)
|
||||
return comp
|
||||
.split(/\s+/)
|
||||
.map((c) => replaceXRange(c, options))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
const replaceXRange = (comp, options) => {
|
||||
comp = comp.trim()
|
||||
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
const xM = isX(M)
|
||||
const xm = xM || isX(m)
|
||||
const xp = xm || isX(p)
|
||||
const anyX = xp
|
||||
|
||||
if (gtlt === '=' && anyX) {
|
||||
gtlt = ''
|
||||
}
|
||||
|
||||
// if we're including prereleases in the match, then we need
|
||||
// to fix this to -0, the lowest possible prerelease value
|
||||
pr = options.includePrerelease ? '-0' : ''
|
||||
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0-0'
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
}
|
||||
} else if (gtlt && anyX) {
|
||||
// we know patch is an x, because we have any x at all.
|
||||
// replace X with 0
|
||||
if (xm) {
|
||||
m = 0
|
||||
}
|
||||
p = 0
|
||||
|
||||
if (gtlt === '>') {
|
||||
// >1 => >=2.0.0
|
||||
// >1.2 => >=1.3.0
|
||||
gtlt = '>='
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
m = 0
|
||||
p = 0
|
||||
} else {
|
||||
m = +m + 1
|
||||
p = 0
|
||||
}
|
||||
} else if (gtlt === '<=') {
|
||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||
gtlt = '<'
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
} else {
|
||||
m = +m + 1
|
||||
}
|
||||
}
|
||||
|
||||
if (gtlt === '<') {
|
||||
pr = '-0'
|
||||
}
|
||||
|
||||
ret = `${gtlt + M}.${m}.${p}${pr}`
|
||||
} else if (xm) {
|
||||
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
|
||||
} else if (xp) {
|
||||
ret = `>=${M}.${m}.0${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// Because * is AND-ed with everything else in the comparator,
|
||||
// and '' means "any version", just remove the *s entirely.
|
||||
const replaceStars = (comp, options) => {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp
|
||||
.trim()
|
||||
.replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
const replaceGTE0 = (comp, options) => {
|
||||
debug('replaceGTE0', comp, options)
|
||||
return comp
|
||||
.trim()
|
||||
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
||||
// TODO build?
|
||||
const hyphenReplace = incPr => ($0,
|
||||
from, fM, fm, fp, fpr, fb,
|
||||
to, tM, tm, tp, tpr) => {
|
||||
if (isX(fM)) {
|
||||
from = ''
|
||||
} else if (isX(fm)) {
|
||||
from = `>=${fM}.0.0${incPr ? '-0' : ''}`
|
||||
} else if (isX(fp)) {
|
||||
from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
|
||||
} else if (fpr) {
|
||||
from = `>=${from}`
|
||||
} else {
|
||||
from = `>=${from}${incPr ? '-0' : ''}`
|
||||
}
|
||||
|
||||
if (isX(tM)) {
|
||||
to = ''
|
||||
} else if (isX(tm)) {
|
||||
to = `<${+tM + 1}.0.0-0`
|
||||
} else if (isX(tp)) {
|
||||
to = `<${tM}.${+tm + 1}.0-0`
|
||||
} else if (tpr) {
|
||||
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
||||
} else if (incPr) {
|
||||
to = `<${tM}.${tm}.${+tp + 1}-0`
|
||||
} else {
|
||||
to = `<=${to}`
|
||||
}
|
||||
|
||||
return `${from} ${to}`.trim()
|
||||
}
|
||||
|
||||
const testSet = (set, version, options) => {
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
if (!set[i].test(version)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (version.prerelease.length && !options.includePrerelease) {
|
||||
// Find the set of versions that are allowed to have prereleases
|
||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||
// That should allow `1.2.3-pr.2` to pass.
|
||||
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
||||
// even though it's within the range set by the comparators.
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
debug(set[i].semver)
|
||||
if (set[i].semver === Comparator.ANY) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (set[i].semver.prerelease.length > 0) {
|
||||
const allowed = set[i].semver
|
||||
if (allowed.major === version.major &&
|
||||
allowed.minor === version.minor &&
|
||||
allowed.patch === version.patch) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Version has a -pre, but it's not one of the ones we like.
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
302
node_modules/css-loader/node_modules/semver/classes/semver.js
generated
vendored
Normal file
302
node_modules/css-loader/node_modules/semver/classes/semver.js
generated
vendored
Normal file
@ -0,0 +1,302 @@
|
||||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { safeRe: re, t } = require('../internal/re')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === !!options.loose &&
|
||||
version.includePrerelease === !!options.includePrerelease) {
|
||||
return version
|
||||
} else {
|
||||
version = version.version
|
||||
}
|
||||
} else if (typeof version !== 'string') {
|
||||
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
throw new TypeError(
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
)
|
||||
}
|
||||
|
||||
debug('SemVer', version, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
// this isn't actually relevant for versions, but keep it so that we
|
||||
// don't run into trouble passing this.options around.
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
this.raw = version
|
||||
|
||||
// these are actually numbers
|
||||
this.major = +m[1]
|
||||
this.minor = +m[2]
|
||||
this.patch = +m[3]
|
||||
|
||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||
throw new TypeError('Invalid major version')
|
||||
}
|
||||
|
||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||
throw new TypeError('Invalid minor version')
|
||||
}
|
||||
|
||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||
throw new TypeError('Invalid patch version')
|
||||
}
|
||||
|
||||
// numberify any prerelease numeric ids
|
||||
if (!m[4]) {
|
||||
this.prerelease = []
|
||||
} else {
|
||||
this.prerelease = m[4].split('.').map((id) => {
|
||||
if (/^[0-9]+$/.test(id)) {
|
||||
const num = +id
|
||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||
return num
|
||||
}
|
||||
}
|
||||
return id
|
||||
})
|
||||
}
|
||||
|
||||
this.build = m[5] ? m[5].split('.') : []
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||
if (this.prerelease.length) {
|
||||
this.version += `-${this.prerelease.join('.')}`
|
||||
}
|
||||
return this.version
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.version
|
||||
}
|
||||
|
||||
compare (other) {
|
||||
debug('SemVer.compare', this.version, this.options, other)
|
||||
if (!(other instanceof SemVer)) {
|
||||
if (typeof other === 'string' && other === this.version) {
|
||||
return 0
|
||||
}
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (other.version === this.version) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other)
|
||||
}
|
||||
|
||||
compareMain (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
return (
|
||||
compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
compareIdentifiers(this.patch, other.patch)
|
||||
)
|
||||
}
|
||||
|
||||
comparePre (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length) {
|
||||
return -1
|
||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||
return 1
|
||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.prerelease[i]
|
||||
const b = other.prerelease[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
compareBuild (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.build[i]
|
||||
const b = other.build[i]
|
||||
debug('build compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
inc (release, identifier, identifierBase) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor = 0
|
||||
this.major++
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
case 'preminor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor++
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0
|
||||
this.inc('patch', identifier, identifierBase)
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.inc('patch', identifier, identifierBase)
|
||||
}
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
|
||||
case 'major':
|
||||
// If this is a pre-major version, bump up to the same major version.
|
||||
// Otherwise increment major.
|
||||
// 1.0.0-5 bumps to 1.0.0
|
||||
// 1.1.0 bumps to 2.0.0
|
||||
if (
|
||||
this.minor !== 0 ||
|
||||
this.patch !== 0 ||
|
||||
this.prerelease.length === 0
|
||||
) {
|
||||
this.major++
|
||||
}
|
||||
this.minor = 0
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'minor':
|
||||
// If this is a pre-minor version, bump up to the same minor version.
|
||||
// Otherwise increment minor.
|
||||
// 1.2.0-5 bumps to 1.2.0
|
||||
// 1.2.1 bumps to 1.3.0
|
||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||
this.minor++
|
||||
}
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'patch':
|
||||
// If this is not a pre-release version, it will increment the patch.
|
||||
// If it is a pre-release it will bump up to the same patch version.
|
||||
// 1.2.0-5 patches to 1.2.0
|
||||
// 1.2.0 patches to 1.2.1
|
||||
if (this.prerelease.length === 0) {
|
||||
this.patch++
|
||||
}
|
||||
this.prerelease = []
|
||||
break
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre': {
|
||||
const base = Number(identifierBase) ? 1 : 0
|
||||
|
||||
if (!identifier && identifierBase === false) {
|
||||
throw new Error('invalid increment argument: identifier is empty')
|
||||
}
|
||||
|
||||
if (this.prerelease.length === 0) {
|
||||
this.prerelease = [base]
|
||||
} else {
|
||||
let i = this.prerelease.length
|
||||
while (--i >= 0) {
|
||||
if (typeof this.prerelease[i] === 'number') {
|
||||
this.prerelease[i]++
|
||||
i = -2
|
||||
}
|
||||
}
|
||||
if (i === -1) {
|
||||
// didn't increment anything
|
||||
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
||||
throw new Error('invalid increment argument: identifier already exists')
|
||||
}
|
||||
this.prerelease.push(base)
|
||||
}
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
let prerelease = [identifier, base]
|
||||
if (identifierBase === false) {
|
||||
prerelease = [identifier]
|
||||
}
|
||||
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
||||
if (isNaN(this.prerelease[1])) {
|
||||
this.prerelease = prerelease
|
||||
}
|
||||
} else {
|
||||
this.prerelease = prerelease
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
default:
|
||||
throw new Error(`invalid increment argument: ${release}`)
|
||||
}
|
||||
this.raw = this.format()
|
||||
if (this.build.length) {
|
||||
this.raw += `+${this.build.join('.')}`
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SemVer
|
6
node_modules/css-loader/node_modules/semver/functions/clean.js
generated
vendored
Normal file
6
node_modules/css-loader/node_modules/semver/functions/clean.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
const parse = require('./parse')
|
||||
const clean = (version, options) => {
|
||||
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
||||
return s ? s.version : null
|
||||
}
|
||||
module.exports = clean
|
52
node_modules/css-loader/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
52
node_modules/css-loader/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
const eq = require('./eq')
|
||||
const neq = require('./neq')
|
||||
const gt = require('./gt')
|
||||
const gte = require('./gte')
|
||||
const lt = require('./lt')
|
||||
const lte = require('./lte')
|
||||
|
||||
const cmp = (a, op, b, loose) => {
|
||||
switch (op) {
|
||||
case '===':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a === b
|
||||
|
||||
case '!==':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a !== b
|
||||
|
||||
case '':
|
||||
case '=':
|
||||
case '==':
|
||||
return eq(a, b, loose)
|
||||
|
||||
case '!=':
|
||||
return neq(a, b, loose)
|
||||
|
||||
case '>':
|
||||
return gt(a, b, loose)
|
||||
|
||||
case '>=':
|
||||
return gte(a, b, loose)
|
||||
|
||||
case '<':
|
||||
return lt(a, b, loose)
|
||||
|
||||
case '<=':
|
||||
return lte(a, b, loose)
|
||||
|
||||
default:
|
||||
throw new TypeError(`Invalid operator: ${op}`)
|
||||
}
|
||||
}
|
||||
module.exports = cmp
|
60
node_modules/css-loader/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
60
node_modules/css-loader/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const parse = require('./parse')
|
||||
const { safeRe: re, t } = require('../internal/re')
|
||||
|
||||
const coerce = (version, options) => {
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
let match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
||||
// With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
|
||||
//
|
||||
// Walk through the string checking with a /g regexp
|
||||
// Manually set the index so as to pick up overlapping matches.
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]
|
||||
let next
|
||||
while ((next = coerceRtlRegex.exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
coerceRtlRegex.lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
const major = match[2]
|
||||
const minor = match[3] || '0'
|
||||
const patch = match[4] || '0'
|
||||
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''
|
||||
const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''
|
||||
|
||||
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
|
||||
}
|
||||
module.exports = coerce
|
7
node_modules/css-loader/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
7
node_modules/css-loader/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const compareBuild = (a, b, loose) => {
|
||||
const versionA = new SemVer(a, loose)
|
||||
const versionB = new SemVer(b, loose)
|
||||
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
||||
}
|
||||
module.exports = compareBuild
|
3
node_modules/css-loader/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const compareLoose = (a, b) => compare(a, b, true)
|
||||
module.exports = compareLoose
|
5
node_modules/css-loader/node_modules/semver/functions/compare.js
generated
vendored
Normal file
5
node_modules/css-loader/node_modules/semver/functions/compare.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const compare = (a, b, loose) =>
|
||||
new SemVer(a, loose).compare(new SemVer(b, loose))
|
||||
|
||||
module.exports = compare
|
65
node_modules/css-loader/node_modules/semver/functions/diff.js
generated
vendored
Normal file
65
node_modules/css-loader/node_modules/semver/functions/diff.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
const parse = require('./parse.js')
|
||||
|
||||
const diff = (version1, version2) => {
|
||||
const v1 = parse(version1, null, true)
|
||||
const v2 = parse(version2, null, true)
|
||||
const comparison = v1.compare(v2)
|
||||
|
||||
if (comparison === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
const v1Higher = comparison > 0
|
||||
const highVersion = v1Higher ? v1 : v2
|
||||
const lowVersion = v1Higher ? v2 : v1
|
||||
const highHasPre = !!highVersion.prerelease.length
|
||||
const lowHasPre = !!lowVersion.prerelease.length
|
||||
|
||||
if (lowHasPre && !highHasPre) {
|
||||
// Going from prerelease -> no prerelease requires some special casing
|
||||
|
||||
// If the low version has only a major, then it will always be a major
|
||||
// Some examples:
|
||||
// 1.0.0-1 -> 1.0.0
|
||||
// 1.0.0-1 -> 1.1.1
|
||||
// 1.0.0-1 -> 2.0.0
|
||||
if (!lowVersion.patch && !lowVersion.minor) {
|
||||
return 'major'
|
||||
}
|
||||
|
||||
// Otherwise it can be determined by checking the high version
|
||||
|
||||
if (highVersion.patch) {
|
||||
// anything higher than a patch bump would result in the wrong version
|
||||
return 'patch'
|
||||
}
|
||||
|
||||
if (highVersion.minor) {
|
||||
// anything higher than a minor bump would result in the wrong version
|
||||
return 'minor'
|
||||
}
|
||||
|
||||
// bumping major/minor/patch all have same result
|
||||
return 'major'
|
||||
}
|
||||
|
||||
// add the `pre` prefix if we are going to a prerelease version
|
||||
const prefix = highHasPre ? 'pre' : ''
|
||||
|
||||
if (v1.major !== v2.major) {
|
||||
return prefix + 'major'
|
||||
}
|
||||
|
||||
if (v1.minor !== v2.minor) {
|
||||
return prefix + 'minor'
|
||||
}
|
||||
|
||||
if (v1.patch !== v2.patch) {
|
||||
return prefix + 'patch'
|
||||
}
|
||||
|
||||
// high and low are preleases
|
||||
return 'prerelease'
|
||||
}
|
||||
|
||||
module.exports = diff
|
3
node_modules/css-loader/node_modules/semver/functions/eq.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/eq.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
||||
module.exports = eq
|
3
node_modules/css-loader/node_modules/semver/functions/gt.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/gt.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const gt = (a, b, loose) => compare(a, b, loose) > 0
|
||||
module.exports = gt
|
3
node_modules/css-loader/node_modules/semver/functions/gte.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/gte.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const gte = (a, b, loose) => compare(a, b, loose) >= 0
|
||||
module.exports = gte
|
19
node_modules/css-loader/node_modules/semver/functions/inc.js
generated
vendored
Normal file
19
node_modules/css-loader/node_modules/semver/functions/inc.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const inc = (version, release, options, identifier, identifierBase) => {
|
||||
if (typeof (options) === 'string') {
|
||||
identifierBase = identifier
|
||||
identifier = options
|
||||
options = undefined
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(
|
||||
version instanceof SemVer ? version.version : version,
|
||||
options
|
||||
).inc(release, identifier, identifierBase).version
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = inc
|
3
node_modules/css-loader/node_modules/semver/functions/lt.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/lt.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const lt = (a, b, loose) => compare(a, b, loose) < 0
|
||||
module.exports = lt
|
3
node_modules/css-loader/node_modules/semver/functions/lte.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/lte.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const lte = (a, b, loose) => compare(a, b, loose) <= 0
|
||||
module.exports = lte
|
3
node_modules/css-loader/node_modules/semver/functions/major.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/major.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const major = (a, loose) => new SemVer(a, loose).major
|
||||
module.exports = major
|
3
node_modules/css-loader/node_modules/semver/functions/minor.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/minor.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const minor = (a, loose) => new SemVer(a, loose).minor
|
||||
module.exports = minor
|
3
node_modules/css-loader/node_modules/semver/functions/neq.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/neq.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
||||
module.exports = neq
|
16
node_modules/css-loader/node_modules/semver/functions/parse.js
generated
vendored
Normal file
16
node_modules/css-loader/node_modules/semver/functions/parse.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const parse = (version, options, throwErrors = false) => {
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
try {
|
||||
return new SemVer(version, options)
|
||||
} catch (er) {
|
||||
if (!throwErrors) {
|
||||
return null
|
||||
}
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parse
|
3
node_modules/css-loader/node_modules/semver/functions/patch.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/patch.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const patch = (a, loose) => new SemVer(a, loose).patch
|
||||
module.exports = patch
|
6
node_modules/css-loader/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
6
node_modules/css-loader/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
const parse = require('./parse')
|
||||
const prerelease = (version, options) => {
|
||||
const parsed = parse(version, options)
|
||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
||||
}
|
||||
module.exports = prerelease
|
3
node_modules/css-loader/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const rcompare = (a, b, loose) => compare(b, a, loose)
|
||||
module.exports = rcompare
|
3
node_modules/css-loader/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compareBuild = require('./compare-build')
|
||||
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
|
||||
module.exports = rsort
|
10
node_modules/css-loader/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
10
node_modules/css-loader/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
const Range = require('../classes/range')
|
||||
const satisfies = (version, range, options) => {
|
||||
try {
|
||||
range = new Range(range, options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
return range.test(version)
|
||||
}
|
||||
module.exports = satisfies
|
3
node_modules/css-loader/node_modules/semver/functions/sort.js
generated
vendored
Normal file
3
node_modules/css-loader/node_modules/semver/functions/sort.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
const compareBuild = require('./compare-build')
|
||||
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
|
||||
module.exports = sort
|
6
node_modules/css-loader/node_modules/semver/functions/valid.js
generated
vendored
Normal file
6
node_modules/css-loader/node_modules/semver/functions/valid.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
const parse = require('./parse')
|
||||
const valid = (version, options) => {
|
||||
const v = parse(version, options)
|
||||
return v ? v.version : null
|
||||
}
|
||||
module.exports = valid
|
89
node_modules/css-loader/node_modules/semver/index.js
generated
vendored
Normal file
89
node_modules/css-loader/node_modules/semver/index.js
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
// just pre-load all the stuff that index.js lazily exports
|
||||
const internalRe = require('./internal/re')
|
||||
const constants = require('./internal/constants')
|
||||
const SemVer = require('./classes/semver')
|
||||
const identifiers = require('./internal/identifiers')
|
||||
const parse = require('./functions/parse')
|
||||
const valid = require('./functions/valid')
|
||||
const clean = require('./functions/clean')
|
||||
const inc = require('./functions/inc')
|
||||
const diff = require('./functions/diff')
|
||||
const major = require('./functions/major')
|
||||
const minor = require('./functions/minor')
|
||||
const patch = require('./functions/patch')
|
||||
const prerelease = require('./functions/prerelease')
|
||||
const compare = require('./functions/compare')
|
||||
const rcompare = require('./functions/rcompare')
|
||||
const compareLoose = require('./functions/compare-loose')
|
||||
const compareBuild = require('./functions/compare-build')
|
||||
const sort = require('./functions/sort')
|
||||
const rsort = require('./functions/rsort')
|
||||
const gt = require('./functions/gt')
|
||||
const lt = require('./functions/lt')
|
||||
const eq = require('./functions/eq')
|
||||
const neq = require('./functions/neq')
|
||||
const gte = require('./functions/gte')
|
||||
const lte = require('./functions/lte')
|
||||
const cmp = require('./functions/cmp')
|
||||
const coerce = require('./functions/coerce')
|
||||
const Comparator = require('./classes/comparator')
|
||||
const Range = require('./classes/range')
|
||||
const satisfies = require('./functions/satisfies')
|
||||
const toComparators = require('./ranges/to-comparators')
|
||||
const maxSatisfying = require('./ranges/max-satisfying')
|
||||
const minSatisfying = require('./ranges/min-satisfying')
|
||||
const minVersion = require('./ranges/min-version')
|
||||
const validRange = require('./ranges/valid')
|
||||
const outside = require('./ranges/outside')
|
||||
const gtr = require('./ranges/gtr')
|
||||
const ltr = require('./ranges/ltr')
|
||||
const intersects = require('./ranges/intersects')
|
||||
const simplifyRange = require('./ranges/simplify')
|
||||
const subset = require('./ranges/subset')
|
||||
module.exports = {
|
||||
parse,
|
||||
valid,
|
||||
clean,
|
||||
inc,
|
||||
diff,
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
prerelease,
|
||||
compare,
|
||||
rcompare,
|
||||
compareLoose,
|
||||
compareBuild,
|
||||
sort,
|
||||
rsort,
|
||||
gt,
|
||||
lt,
|
||||
eq,
|
||||
neq,
|
||||
gte,
|
||||
lte,
|
||||
cmp,
|
||||
coerce,
|
||||
Comparator,
|
||||
Range,
|
||||
satisfies,
|
||||
toComparators,
|
||||
maxSatisfying,
|
||||
minSatisfying,
|
||||
minVersion,
|
||||
validRange,
|
||||
outside,
|
||||
gtr,
|
||||
ltr,
|
||||
intersects,
|
||||
simplifyRange,
|
||||
subset,
|
||||
SemVer,
|
||||
re: internalRe.re,
|
||||
src: internalRe.src,
|
||||
tokens: internalRe.t,
|
||||
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
||||
RELEASE_TYPES: constants.RELEASE_TYPES,
|
||||
compareIdentifiers: identifiers.compareIdentifiers,
|
||||
rcompareIdentifiers: identifiers.rcompareIdentifiers,
|
||||
}
|
35
node_modules/css-loader/node_modules/semver/internal/constants.js
generated
vendored
Normal file
35
node_modules/css-loader/node_modules/semver/internal/constants.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Note: this is the semver.org version of the spec that it implements
|
||||
// Not necessarily the package version of this code.
|
||||
const SEMVER_SPEC_VERSION = '2.0.0'
|
||||
|
||||
const MAX_LENGTH = 256
|
||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||
/* istanbul ignore next */ 9007199254740991
|
||||
|
||||
// Max safe segment length for coercion.
|
||||
const MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
|
||||
// Max safe length for a build identifier. The max length minus 6 characters for
|
||||
// the shortest version with a build 0.0.0+BUILD.
|
||||
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
||||
|
||||
const RELEASE_TYPES = [
|
||||
'major',
|
||||
'premajor',
|
||||
'minor',
|
||||
'preminor',
|
||||
'patch',
|
||||
'prepatch',
|
||||
'prerelease',
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH,
|
||||
MAX_SAFE_COMPONENT_LENGTH,
|
||||
MAX_SAFE_BUILD_LENGTH,
|
||||
MAX_SAFE_INTEGER,
|
||||
RELEASE_TYPES,
|
||||
SEMVER_SPEC_VERSION,
|
||||
FLAG_INCLUDE_PRERELEASE: 0b001,
|
||||
FLAG_LOOSE: 0b010,
|
||||
}
|
9
node_modules/css-loader/node_modules/semver/internal/debug.js
generated
vendored
Normal file
9
node_modules/css-loader/node_modules/semver/internal/debug.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
const debug = (
|
||||
typeof process === 'object' &&
|
||||
process.env &&
|
||||
process.env.NODE_DEBUG &&
|
||||
/\bsemver\b/i.test(process.env.NODE_DEBUG)
|
||||
) ? (...args) => console.error('SEMVER', ...args)
|
||||
: () => {}
|
||||
|
||||
module.exports = debug
|
23
node_modules/css-loader/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
23
node_modules/css-loader/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
const numeric = /^[0-9]+$/
|
||||
const compareIdentifiers = (a, b) => {
|
||||
const anum = numeric.test(a)
|
||||
const bnum = numeric.test(b)
|
||||
|
||||
if (anum && bnum) {
|
||||
a = +a
|
||||
b = +b
|
||||
}
|
||||
|
||||
return a === b ? 0
|
||||
: (anum && !bnum) ? -1
|
||||
: (bnum && !anum) ? 1
|
||||
: a < b ? -1
|
||||
: 1
|
||||
}
|
||||
|
||||
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
|
||||
|
||||
module.exports = {
|
||||
compareIdentifiers,
|
||||
rcompareIdentifiers,
|
||||
}
|
40
node_modules/css-loader/node_modules/semver/internal/lrucache.js
generated
vendored
Normal file
40
node_modules/css-loader/node_modules/semver/internal/lrucache.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
class LRUCache {
|
||||
constructor () {
|
||||
this.max = 1000
|
||||
this.map = new Map()
|
||||
}
|
||||
|
||||
get (key) {
|
||||
const value = this.map.get(key)
|
||||
if (value === undefined) {
|
||||
return undefined
|
||||
} else {
|
||||
// Remove the key from the map and add it to the end
|
||||
this.map.delete(key)
|
||||
this.map.set(key, value)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
delete (key) {
|
||||
return this.map.delete(key)
|
||||
}
|
||||
|
||||
set (key, value) {
|
||||
const deleted = this.delete(key)
|
||||
|
||||
if (!deleted && value !== undefined) {
|
||||
// If cache is full, delete the least recently used item
|
||||
if (this.map.size >= this.max) {
|
||||
const firstKey = this.map.keys().next().value
|
||||
this.delete(firstKey)
|
||||
}
|
||||
|
||||
this.map.set(key, value)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LRUCache
|
15
node_modules/css-loader/node_modules/semver/internal/parse-options.js
generated
vendored
Normal file
15
node_modules/css-loader/node_modules/semver/internal/parse-options.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// parse out just the options we care about
|
||||
const looseOption = Object.freeze({ loose: true })
|
||||
const emptyOpts = Object.freeze({ })
|
||||
const parseOptions = options => {
|
||||
if (!options) {
|
||||
return emptyOpts
|
||||
}
|
||||
|
||||
if (typeof options !== 'object') {
|
||||
return looseOption
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
module.exports = parseOptions
|
217
node_modules/css-loader/node_modules/semver/internal/re.js
generated
vendored
Normal file
217
node_modules/css-loader/node_modules/semver/internal/re.js
generated
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
const {
|
||||
MAX_SAFE_COMPONENT_LENGTH,
|
||||
MAX_SAFE_BUILD_LENGTH,
|
||||
MAX_LENGTH,
|
||||
} = require('./constants')
|
||||
const debug = require('./debug')
|
||||
exports = module.exports = {}
|
||||
|
||||
// The actual regexps go on exports.re
|
||||
const re = exports.re = []
|
||||
const safeRe = exports.safeRe = []
|
||||
const src = exports.src = []
|
||||
const t = exports.t = {}
|
||||
let R = 0
|
||||
|
||||
const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
||||
|
||||
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
||||
// used internally via the safeRe object since all inputs in this library get
|
||||
// normalized first to trim and collapse all extra whitespace. The original
|
||||
// regexes are exported for userland consumption and lower level usage. A
|
||||
// future breaking change could export the safer regex only with a note that
|
||||
// all input should have extra whitespace removed.
|
||||
const safeRegexReplacements = [
|
||||
['\\s', 1],
|
||||
['\\d', MAX_LENGTH],
|
||||
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
||||
]
|
||||
|
||||
const makeSafeRegex = (value) => {
|
||||
for (const [token, max] of safeRegexReplacements) {
|
||||
value = value
|
||||
.split(`${token}*`).join(`${token}{0,${max}}`)
|
||||
.split(`${token}+`).join(`${token}{1,${max}}`)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
const createToken = (name, value, isGlobal) => {
|
||||
const safe = makeSafeRegex(value)
|
||||
const index = R++
|
||||
debug(name, index, value)
|
||||
t[name] = index
|
||||
src[index] = value
|
||||
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
||||
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
// ## Numeric Identifier
|
||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||
|
||||
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
|
||||
createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
|
||||
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIER]})`)
|
||||
|
||||
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
||||
|
||||
// ## Pre-release Version Identifier
|
||||
// A numeric identifier, or a non-numeric identifier.
|
||||
|
||||
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
|
||||
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
||||
|
||||
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
|
||||
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
||||
|
||||
// ## Pre-release Version
|
||||
// Hyphen, followed by one or more dot-separated pre-release version
|
||||
// identifiers.
|
||||
|
||||
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
||||
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
|
||||
|
||||
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
||||
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
|
||||
|
||||
// ## Build Metadata Identifier
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
// identifiers.
|
||||
|
||||
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
||||
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
|
||||
|
||||
// ## Full Version String
|
||||
// A main version, followed optionally by a pre-release version and
|
||||
// build metadata.
|
||||
|
||||
// Note that the only major, minor, patch, and pre-release sections of
|
||||
// the version string are capturing groups. The build metadata is not a
|
||||
// capturing group, because it should not ever be used in version
|
||||
// comparison.
|
||||
|
||||
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
||||
}${src[t.PRERELEASE]}?${
|
||||
src[t.BUILD]}?`)
|
||||
|
||||
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
|
||||
|
||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||
// common in the npm registry.
|
||||
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
||||
}${src[t.PRERELEASELOOSE]}?${
|
||||
src[t.BUILD]}?`)
|
||||
|
||||
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
||||
|
||||
createToken('GTLT', '((?:<|>)?=?)')
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
||||
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
||||
|
||||
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:${src[t.PRERELEASE]})?${
|
||||
src[t.BUILD]}?` +
|
||||
`)?)?`)
|
||||
|
||||
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:${src[t.PRERELEASELOOSE]})?${
|
||||
src[t.BUILD]}?` +
|
||||
`)?)?`)
|
||||
|
||||
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
||||
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
|
||||
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
|
||||
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
||||
`(?:${src[t.PRERELEASE]})?` +
|
||||
`(?:${src[t.BUILD]})?` +
|
||||
`(?:$|[^\\d])`)
|
||||
createToken('COERCERTL', src[t.COERCE], true)
|
||||
createToken('COERCERTLFULL', src[t.COERCEFULL], true)
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
createToken('LONETILDE', '(?:~>?)')
|
||||
|
||||
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
|
||||
exports.tildeTrimReplace = '$1~'
|
||||
|
||||
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// Caret ranges.
|
||||
// Meaning is "at least and backwards compatible with"
|
||||
createToken('LONECARET', '(?:\\^)')
|
||||
|
||||
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
|
||||
exports.caretTrimReplace = '$1^'
|
||||
|
||||
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
|
||||
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
|
||||
|
||||
// An expression to strip any whitespace between the gtlt and the thing
|
||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
||||
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
|
||||
exports.comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
// Note that these all use the loose form, because they'll be
|
||||
// checked against either the strict or loose comparator form
|
||||
// later.
|
||||
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
||||
`\\s+-\\s+` +
|
||||
`(${src[t.XRANGEPLAIN]})` +
|
||||
`\\s*$`)
|
||||
|
||||
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
||||
`\\s+-\\s+` +
|
||||
`(${src[t.XRANGEPLAINLOOSE]})` +
|
||||
`\\s*$`)
|
||||
|
||||
// Star ranges basically just allow anything at all.
|
||||
createToken('STAR', '(<|>)?=?\\s*\\*')
|
||||
// >=0.0.0 is like a star
|
||||
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
|
||||
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
|
77
node_modules/css-loader/node_modules/semver/package.json
generated
vendored
Normal file
77
node_modules/css-loader/node_modules/semver/package.json
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "semver",
|
||||
"version": "7.6.3",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
|
||||
"postlint": "template-oss-check",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"posttest": "npm run lint",
|
||||
"template-oss-apply": "template-oss-apply --force"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.22.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^16.0.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/",
|
||||
"classes/",
|
||||
"functions/",
|
||||
"internal/",
|
||||
"ranges/",
|
||||
"index.js",
|
||||
"preload.js",
|
||||
"range.bnf"
|
||||
],
|
||||
"tap": {
|
||||
"timeout": 30,
|
||||
"coverage-map": "map.js",
|
||||
"nyc-arg": [
|
||||
"--exclude",
|
||||
"tap-snapshots/**"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.22.0",
|
||||
"engines": ">=10",
|
||||
"distPaths": [
|
||||
"classes/",
|
||||
"functions/",
|
||||
"internal/",
|
||||
"ranges/",
|
||||
"index.js",
|
||||
"preload.js",
|
||||
"range.bnf"
|
||||
],
|
||||
"allowPaths": [
|
||||
"/classes/",
|
||||
"/functions/",
|
||||
"/internal/",
|
||||
"/ranges/",
|
||||
"/index.js",
|
||||
"/preload.js",
|
||||
"/range.bnf",
|
||||
"/benchmarks"
|
||||
],
|
||||
"publish": "true"
|
||||
}
|
||||
}
|
2
node_modules/css-loader/node_modules/semver/preload.js
generated
vendored
Normal file
2
node_modules/css-loader/node_modules/semver/preload.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// XXX remove in v8 or beyond
|
||||
module.exports = require('./index.js')
|
16
node_modules/css-loader/node_modules/semver/range.bnf
generated
vendored
Normal file
16
node_modules/css-loader/node_modules/semver/range.bnf
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
4
node_modules/css-loader/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
4
node_modules/css-loader/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
// Determine if version is greater than all the versions possible in the range.
|
||||
const outside = require('./outside')
|
||||
const gtr = (version, range, options) => outside(version, range, '>', options)
|
||||
module.exports = gtr
|
7
node_modules/css-loader/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
7
node_modules/css-loader/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const Range = require('../classes/range')
|
||||
const intersects = (r1, r2, options) => {
|
||||
r1 = new Range(r1, options)
|
||||
r2 = new Range(r2, options)
|
||||
return r1.intersects(r2, options)
|
||||
}
|
||||
module.exports = intersects
|
4
node_modules/css-loader/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
4
node_modules/css-loader/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
const outside = require('./outside')
|
||||
// Determine if version is less than all the versions possible in the range
|
||||
const ltr = (version, range, options) => outside(version, range, '<', options)
|
||||
module.exports = ltr
|
25
node_modules/css-loader/node_modules/semver/ranges/max-satisfying.js
generated
vendored
Normal file
25
node_modules/css-loader/node_modules/semver/ranges/max-satisfying.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
|
||||
const maxSatisfying = (versions, range, options) => {
|
||||
let max = null
|
||||
let maxSV = null
|
||||
let rangeObj = null
|
||||
try {
|
||||
rangeObj = new Range(range, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
versions.forEach((v) => {
|
||||
if (rangeObj.test(v)) {
|
||||
// satisfies(v, range, options)
|
||||
if (!max || maxSV.compare(v) === -1) {
|
||||
// compare(max, v, true)
|
||||
max = v
|
||||
maxSV = new SemVer(max, options)
|
||||
}
|
||||
}
|
||||
})
|
||||
return max
|
||||
}
|
||||
module.exports = maxSatisfying
|
24
node_modules/css-loader/node_modules/semver/ranges/min-satisfying.js
generated
vendored
Normal file
24
node_modules/css-loader/node_modules/semver/ranges/min-satisfying.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
const minSatisfying = (versions, range, options) => {
|
||||
let min = null
|
||||
let minSV = null
|
||||
let rangeObj = null
|
||||
try {
|
||||
rangeObj = new Range(range, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
versions.forEach((v) => {
|
||||
if (rangeObj.test(v)) {
|
||||
// satisfies(v, range, options)
|
||||
if (!min || minSV.compare(v) === 1) {
|
||||
// compare(min, v, true)
|
||||
min = v
|
||||
minSV = new SemVer(min, options)
|
||||
}
|
||||
}
|
||||
})
|
||||
return min
|
||||
}
|
||||
module.exports = minSatisfying
|
61
node_modules/css-loader/node_modules/semver/ranges/min-version.js
generated
vendored
Normal file
61
node_modules/css-loader/node_modules/semver/ranges/min-version.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
const gt = require('../functions/gt')
|
||||
|
||||
const minVersion = (range, loose) => {
|
||||
range = new Range(range, loose)
|
||||
|
||||
let minver = new SemVer('0.0.0')
|
||||
if (range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
minver = new SemVer('0.0.0-0')
|
||||
if (range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
minver = null
|
||||
for (let i = 0; i < range.set.length; ++i) {
|
||||
const comparators = range.set[i]
|
||||
|
||||
let setMin = null
|
||||
comparators.forEach((comparator) => {
|
||||
// Clone to avoid manipulating the comparator's semver object.
|
||||
const compver = new SemVer(comparator.semver.version)
|
||||
switch (comparator.operator) {
|
||||
case '>':
|
||||
if (compver.prerelease.length === 0) {
|
||||
compver.patch++
|
||||
} else {
|
||||
compver.prerelease.push(0)
|
||||
}
|
||||
compver.raw = compver.format()
|
||||
/* fallthrough */
|
||||
case '':
|
||||
case '>=':
|
||||
if (!setMin || gt(compver, setMin)) {
|
||||
setMin = compver
|
||||
}
|
||||
break
|
||||
case '<':
|
||||
case '<=':
|
||||
/* Ignore maximum versions */
|
||||
break
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
||||
}
|
||||
})
|
||||
if (setMin && (!minver || gt(minver, setMin))) {
|
||||
minver = setMin
|
||||
}
|
||||
}
|
||||
|
||||
if (minver && range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
module.exports = minVersion
|
80
node_modules/css-loader/node_modules/semver/ranges/outside.js
generated
vendored
Normal file
80
node_modules/css-loader/node_modules/semver/ranges/outside.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Comparator = require('../classes/comparator')
|
||||
const { ANY } = Comparator
|
||||
const Range = require('../classes/range')
|
||||
const satisfies = require('../functions/satisfies')
|
||||
const gt = require('../functions/gt')
|
||||
const lt = require('../functions/lt')
|
||||
const lte = require('../functions/lte')
|
||||
const gte = require('../functions/gte')
|
||||
|
||||
const outside = (version, range, hilo, options) => {
|
||||
version = new SemVer(version, options)
|
||||
range = new Range(range, options)
|
||||
|
||||
let gtfn, ltefn, ltfn, comp, ecomp
|
||||
switch (hilo) {
|
||||
case '>':
|
||||
gtfn = gt
|
||||
ltefn = lte
|
||||
ltfn = lt
|
||||
comp = '>'
|
||||
ecomp = '>='
|
||||
break
|
||||
case '<':
|
||||
gtfn = lt
|
||||
ltefn = gte
|
||||
ltfn = gt
|
||||
comp = '<'
|
||||
ecomp = '<='
|
||||
break
|
||||
default:
|
||||
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
||||
}
|
||||
|
||||
// If it satisfies the range it is not outside
|
||||
if (satisfies(version, range, options)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// From now on, variable terms are as if we're in "gtr" mode.
|
||||
// but note that everything is flipped for the "ltr" function.
|
||||
|
||||
for (let i = 0; i < range.set.length; ++i) {
|
||||
const comparators = range.set[i]
|
||||
|
||||
let high = null
|
||||
let low = null
|
||||
|
||||
comparators.forEach((comparator) => {
|
||||
if (comparator.semver === ANY) {
|
||||
comparator = new Comparator('>=0.0.0')
|
||||
}
|
||||
high = high || comparator
|
||||
low = low || comparator
|
||||
if (gtfn(comparator.semver, high.semver, options)) {
|
||||
high = comparator
|
||||
} else if (ltfn(comparator.semver, low.semver, options)) {
|
||||
low = comparator
|
||||
}
|
||||
})
|
||||
|
||||
// If the edge version comparator has a operator then our version
|
||||
// isn't outside it
|
||||
if (high.operator === comp || high.operator === ecomp) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If the lowest version comparator has an operator and our version
|
||||
// is less than it then it isn't higher than the range
|
||||
if ((!low.operator || low.operator === comp) &&
|
||||
ltefn(version, low.semver)) {
|
||||
return false
|
||||
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = outside
|
47
node_modules/css-loader/node_modules/semver/ranges/simplify.js
generated
vendored
Normal file
47
node_modules/css-loader/node_modules/semver/ranges/simplify.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
// given a set of versions and a range, create a "simplified" range
|
||||
// that includes the same versions that the original range does
|
||||
// If the original range is shorter than the simplified one, return that.
|
||||
const satisfies = require('../functions/satisfies.js')
|
||||
const compare = require('../functions/compare.js')
|
||||
module.exports = (versions, range, options) => {
|
||||
const set = []
|
||||
let first = null
|
||||
let prev = null
|
||||
const v = versions.sort((a, b) => compare(a, b, options))
|
||||
for (const version of v) {
|
||||
const included = satisfies(version, range, options)
|
||||
if (included) {
|
||||
prev = version
|
||||
if (!first) {
|
||||
first = version
|
||||
}
|
||||
} else {
|
||||
if (prev) {
|
||||
set.push([first, prev])
|
||||
}
|
||||
prev = null
|
||||
first = null
|
||||
}
|
||||
}
|
||||
if (first) {
|
||||
set.push([first, null])
|
||||
}
|
||||
|
||||
const ranges = []
|
||||
for (const [min, max] of set) {
|
||||
if (min === max) {
|
||||
ranges.push(min)
|
||||
} else if (!max && min === v[0]) {
|
||||
ranges.push('*')
|
||||
} else if (!max) {
|
||||
ranges.push(`>=${min}`)
|
||||
} else if (min === v[0]) {
|
||||
ranges.push(`<=${max}`)
|
||||
} else {
|
||||
ranges.push(`${min} - ${max}`)
|
||||
}
|
||||
}
|
||||
const simplified = ranges.join(' || ')
|
||||
const original = typeof range.raw === 'string' ? range.raw : String(range)
|
||||
return simplified.length < original.length ? simplified : range
|
||||
}
|
247
node_modules/css-loader/node_modules/semver/ranges/subset.js
generated
vendored
Normal file
247
node_modules/css-loader/node_modules/semver/ranges/subset.js
generated
vendored
Normal file
@ -0,0 +1,247 @@
|
||||
const Range = require('../classes/range.js')
|
||||
const Comparator = require('../classes/comparator.js')
|
||||
const { ANY } = Comparator
|
||||
const satisfies = require('../functions/satisfies.js')
|
||||
const compare = require('../functions/compare.js')
|
||||
|
||||
// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
|
||||
// - Every simple range `r1, r2, ...` is a null set, OR
|
||||
// - Every simple range `r1, r2, ...` which is not a null set is a subset of
|
||||
// some `R1, R2, ...`
|
||||
//
|
||||
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
|
||||
// - If c is only the ANY comparator
|
||||
// - If C is only the ANY comparator, return true
|
||||
// - Else if in prerelease mode, return false
|
||||
// - else replace c with `[>=0.0.0]`
|
||||
// - If C is only the ANY comparator
|
||||
// - if in prerelease mode, return true
|
||||
// - else replace C with `[>=0.0.0]`
|
||||
// - Let EQ be the set of = comparators in c
|
||||
// - If EQ is more than one, return true (null set)
|
||||
// - Let GT be the highest > or >= comparator in c
|
||||
// - Let LT be the lowest < or <= comparator in c
|
||||
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
|
||||
// - If any C is a = range, and GT or LT are set, return false
|
||||
// - If EQ
|
||||
// - If GT, and EQ does not satisfy GT, return true (null set)
|
||||
// - If LT, and EQ does not satisfy LT, return true (null set)
|
||||
// - If EQ satisfies every C, return true
|
||||
// - Else return false
|
||||
// - If GT
|
||||
// - If GT.semver is lower than any > or >= comp in C, return false
|
||||
// - If GT is >=, and GT.semver does not satisfy every C, return false
|
||||
// - If GT.semver has a prerelease, and not in prerelease mode
|
||||
// - If no C has a prerelease and the GT.semver tuple, return false
|
||||
// - If LT
|
||||
// - If LT.semver is greater than any < or <= comp in C, return false
|
||||
// - If LT is <=, and LT.semver does not satisfy every C, return false
|
||||
// - If GT.semver has a prerelease, and not in prerelease mode
|
||||
// - If no C has a prerelease and the LT.semver tuple, return false
|
||||
// - Else return true
|
||||
|
||||
const subset = (sub, dom, options = {}) => {
|
||||
if (sub === dom) {
|
||||
return true
|
||||
}
|
||||
|
||||
sub = new Range(sub, options)
|
||||
dom = new Range(dom, options)
|
||||
let sawNonNull = false
|
||||
|
||||
OUTER: for (const simpleSub of sub.set) {
|
||||
for (const simpleDom of dom.set) {
|
||||
const isSub = simpleSubset(simpleSub, simpleDom, options)
|
||||
sawNonNull = sawNonNull || isSub !== null
|
||||
if (isSub) {
|
||||
continue OUTER
|
||||
}
|
||||
}
|
||||
// the null set is a subset of everything, but null simple ranges in
|
||||
// a complex range should be ignored. so if we saw a non-null range,
|
||||
// then we know this isn't a subset, but if EVERY simple range was null,
|
||||
// then it is a subset.
|
||||
if (sawNonNull) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
|
||||
const minimumVersion = [new Comparator('>=0.0.0')]
|
||||
|
||||
const simpleSubset = (sub, dom, options) => {
|
||||
if (sub === dom) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (sub.length === 1 && sub[0].semver === ANY) {
|
||||
if (dom.length === 1 && dom[0].semver === ANY) {
|
||||
return true
|
||||
} else if (options.includePrerelease) {
|
||||
sub = minimumVersionWithPreRelease
|
||||
} else {
|
||||
sub = minimumVersion
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.length === 1 && dom[0].semver === ANY) {
|
||||
if (options.includePrerelease) {
|
||||
return true
|
||||
} else {
|
||||
dom = minimumVersion
|
||||
}
|
||||
}
|
||||
|
||||
const eqSet = new Set()
|
||||
let gt, lt
|
||||
for (const c of sub) {
|
||||
if (c.operator === '>' || c.operator === '>=') {
|
||||
gt = higherGT(gt, c, options)
|
||||
} else if (c.operator === '<' || c.operator === '<=') {
|
||||
lt = lowerLT(lt, c, options)
|
||||
} else {
|
||||
eqSet.add(c.semver)
|
||||
}
|
||||
}
|
||||
|
||||
if (eqSet.size > 1) {
|
||||
return null
|
||||
}
|
||||
|
||||
let gtltComp
|
||||
if (gt && lt) {
|
||||
gtltComp = compare(gt.semver, lt.semver, options)
|
||||
if (gtltComp > 0) {
|
||||
return null
|
||||
} else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// will iterate one or zero times
|
||||
for (const eq of eqSet) {
|
||||
if (gt && !satisfies(eq, String(gt), options)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (lt && !satisfies(eq, String(lt), options)) {
|
||||
return null
|
||||
}
|
||||
|
||||
for (const c of dom) {
|
||||
if (!satisfies(eq, String(c), options)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
let higher, lower
|
||||
let hasDomLT, hasDomGT
|
||||
// if the subset has a prerelease, we need a comparator in the superset
|
||||
// with the same tuple and a prerelease, or it's not a subset
|
||||
let needDomLTPre = lt &&
|
||||
!options.includePrerelease &&
|
||||
lt.semver.prerelease.length ? lt.semver : false
|
||||
let needDomGTPre = gt &&
|
||||
!options.includePrerelease &&
|
||||
gt.semver.prerelease.length ? gt.semver : false
|
||||
// exception: <1.2.3-0 is the same as <1.2.3
|
||||
if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
|
||||
lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
|
||||
needDomLTPre = false
|
||||
}
|
||||
|
||||
for (const c of dom) {
|
||||
hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
|
||||
hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
|
||||
if (gt) {
|
||||
if (needDomGTPre) {
|
||||
if (c.semver.prerelease && c.semver.prerelease.length &&
|
||||
c.semver.major === needDomGTPre.major &&
|
||||
c.semver.minor === needDomGTPre.minor &&
|
||||
c.semver.patch === needDomGTPre.patch) {
|
||||
needDomGTPre = false
|
||||
}
|
||||
}
|
||||
if (c.operator === '>' || c.operator === '>=') {
|
||||
higher = higherGT(gt, c, options)
|
||||
if (higher === c && higher !== gt) {
|
||||
return false
|
||||
}
|
||||
} else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (lt) {
|
||||
if (needDomLTPre) {
|
||||
if (c.semver.prerelease && c.semver.prerelease.length &&
|
||||
c.semver.major === needDomLTPre.major &&
|
||||
c.semver.minor === needDomLTPre.minor &&
|
||||
c.semver.patch === needDomLTPre.patch) {
|
||||
needDomLTPre = false
|
||||
}
|
||||
}
|
||||
if (c.operator === '<' || c.operator === '<=') {
|
||||
lower = lowerLT(lt, c, options)
|
||||
if (lower === c && lower !== lt) {
|
||||
return false
|
||||
}
|
||||
} else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// if there was a < or >, and nothing in the dom, then must be false
|
||||
// UNLESS it was limited by another range in the other direction.
|
||||
// Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
|
||||
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
// we needed a prerelease range in a specific tuple, but didn't get one
|
||||
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
|
||||
// because it includes prereleases in the 1.2.3 tuple
|
||||
if (needDomGTPre || needDomLTPre) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// >=1.2.3 is lower than >1.2.3
|
||||
const higherGT = (a, b, options) => {
|
||||
if (!a) {
|
||||
return b
|
||||
}
|
||||
const comp = compare(a.semver, b.semver, options)
|
||||
return comp > 0 ? a
|
||||
: comp < 0 ? b
|
||||
: b.operator === '>' && a.operator === '>=' ? b
|
||||
: a
|
||||
}
|
||||
|
||||
// <=1.2.3 is higher than <1.2.3
|
||||
const lowerLT = (a, b, options) => {
|
||||
if (!a) {
|
||||
return b
|
||||
}
|
||||
const comp = compare(a.semver, b.semver, options)
|
||||
return comp < 0 ? a
|
||||
: comp > 0 ? b
|
||||
: b.operator === '<' && a.operator === '<=' ? b
|
||||
: a
|
||||
}
|
||||
|
||||
module.exports = subset
|
8
node_modules/css-loader/node_modules/semver/ranges/to-comparators.js
generated
vendored
Normal file
8
node_modules/css-loader/node_modules/semver/ranges/to-comparators.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
const Range = require('../classes/range')
|
||||
|
||||
// Mostly just for testing and legacy API reasons
|
||||
const toComparators = (range, options) =>
|
||||
new Range(range, options).set
|
||||
.map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
|
||||
|
||||
module.exports = toComparators
|
11
node_modules/css-loader/node_modules/semver/ranges/valid.js
generated
vendored
Normal file
11
node_modules/css-loader/node_modules/semver/ranges/valid.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
const Range = require('../classes/range')
|
||||
const validRange = (range, options) => {
|
||||
try {
|
||||
// Return '*' instead of '' so that truthiness works.
|
||||
// This will throw if it's invalid anyway
|
||||
return new Range(range, options).range || '*'
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = validRange
|
100
node_modules/css-loader/package.json
generated
vendored
Normal file
100
node_modules/css-loader/package.json
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
{
|
||||
"name": "css-loader",
|
||||
"version": "5.2.7",
|
||||
"description": "css loader module for webpack",
|
||||
"license": "MIT",
|
||||
"repository": "webpack-contrib/css-loader",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"homepage": "https://github.com/webpack-contrib/css-loader",
|
||||
"bugs": "https://github.com/webpack-contrib/css-loader/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"main": "dist/cjs.js",
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run build -- -w",
|
||||
"clean": "del-cli dist",
|
||||
"validate:runtime": "es-check es5 \"dist/runtime/**/*.js\"",
|
||||
"prebuild": "npm run clean",
|
||||
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
||||
"postbuild": "npm run validate:runtime",
|
||||
"commitlint": "commitlint --from=master",
|
||||
"security": "npm audit --production",
|
||||
"lint:prettier": "prettier --list-different .",
|
||||
"lint:js": "eslint --cache .",
|
||||
"lint": "npm-run-all -l -p \"lint:**\"",
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch",
|
||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:coverage",
|
||||
"prepare": "husky install && npm run build",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"webpack": "^4.27.0 || ^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"icss-utils": "^5.1.0",
|
||||
"loader-utils": "^2.0.0",
|
||||
"postcss": "^8.2.15",
|
||||
"postcss-modules-extract-imports": "^3.0.0",
|
||||
"postcss-modules-local-by-default": "^4.0.0",
|
||||
"postcss-modules-scope": "^3.0.0",
|
||||
"postcss-modules-values": "^4.0.0",
|
||||
"postcss-value-parser": "^4.1.0",
|
||||
"schema-utils": "^3.0.0",
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@commitlint/cli": "^12.1.4",
|
||||
"@commitlint/config-conventional": "^12.1.4",
|
||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"del": "^6.0.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"es-check": "^5.2.3",
|
||||
"eslint": "^7.26.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.23.2",
|
||||
"file-loader": "^6.2.0",
|
||||
"husky": "^6.0.0",
|
||||
"jest": "^26.6.3",
|
||||
"less": "^4.1.1",
|
||||
"less-loader": "^7.1.0",
|
||||
"lint-staged": "^11.0.0",
|
||||
"memfs": "^3.2.2",
|
||||
"mini-css-extract-plugin": "^1.6.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss-loader": "^4.3.0",
|
||||
"postcss-preset-env": "^6.7.0",
|
||||
"prettier": "^2.3.0",
|
||||
"sass": "^1.32.13",
|
||||
"sass-loader": "^10.2.0",
|
||||
"standard-version": "^9.3.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"style-loader": "^2.0.0",
|
||||
"stylus": "^0.54.8",
|
||||
"stylus-loader": "^4.3.3",
|
||||
"url-loader": "^4.1.1",
|
||||
"webpack": "^5.37.1"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack",
|
||||
"css",
|
||||
"loader",
|
||||
"url",
|
||||
"import"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user