progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/css-loader/dist
40
assets_old/node_modules/css-loader/dist/CssSyntaxError.js
generated
vendored
Normal file
40
assets_old/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
assets_old/node_modules/css-loader/dist/Warning.js
generated
vendored
Normal file
32
assets_old/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
assets_old/node_modules/css-loader/dist/cjs.js
generated
vendored
Normal file
5
assets_old/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;
|
183
assets_old/node_modules/css-loader/dist/index.js
generated
vendored
Normal file
183
assets_old/node_modules/css-loader/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,183 @@
|
|||
"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 = [];
|
||||
|
||||
if ((0, _utils.shouldUseIcssPlugin)(options)) {
|
||||
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, options);
|
||||
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
||||
}
|
149
assets_old/node_modules/css-loader/dist/options.json
generated
vendored
Normal file
149
assets_old/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
assets_old/node_modules/css-loader/dist/plugins/index.js
generated
vendored
Normal file
31
assets_old/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 }; }
|
118
assets_old/node_modules/css-loader/dist/plugins/postcss-icss-parser.js
generated
vendored
Normal file
118
assets_old/node_modules/css-loader/dist/plugins/postcss-icss-parser.js
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
"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])]);
|
||||
return {
|
||||
url: resolvedUrl,
|
||||
prefix,
|
||||
tokens
|
||||
};
|
||||
};
|
||||
|
||||
tasks.push(doResolve());
|
||||
}
|
||||
|
||||
const results = await Promise.all(tasks);
|
||||
|
||||
for (let index = 0; index <= results.length - 1; index++) {
|
||||
const {
|
||||
url,
|
||||
prefix,
|
||||
tokens
|
||||
} = results[index];
|
||||
const newUrl = prefix ? `${prefix}!${url}` : 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(tokens).entries()) {
|
||||
const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`;
|
||||
const localName = 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;
|
244
assets_old/node_modules/css-loader/dist/plugins/postcss-import-parser.js
generated
vendored
Normal file
244
assets_old/node_modules/css-loader/dist/plugins/postcss-import-parser.js
generated
vendored
Normal file
|
@ -0,0 +1,244 @@
|
|||
"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.webpackIgnoreCommentRegexp);
|
||||
|
||||
if (matched && matched[2] === "true") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const prevNode = atRule.prev();
|
||||
|
||||
if (prevNode && prevNode.type === "comment") {
|
||||
const matched = prevNode.text.match(_utils.webpackIgnoreCommentRegexp);
|
||||
|
||||
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 null;
|
||||
}
|
||||
}
|
||||
|
||||
atRule.remove();
|
||||
|
||||
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])]);
|
||||
return {
|
||||
url: resolvedUrl,
|
||||
media,
|
||||
prefix,
|
||||
isRequestable
|
||||
};
|
||||
}
|
||||
|
||||
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;
|
368
assets_old/node_modules/css-loader/dist/plugins/postcss-url-parser.js
generated
vendored
Normal file
368
assets_old/node_modules/css-loader/dist/plugins/postcss-url-parser.js
generated
vendored
Normal file
|
@ -0,0 +1,368 @@
|
|||
"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.webpackIgnoreCommentRegexp);
|
||||
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.webpackIgnoreCommentRegexp);
|
||||
|
||||
if (matched) {
|
||||
inBetween = matched[2] === "true";
|
||||
}
|
||||
}
|
||||
|
||||
let isIgnoreOnDeclaration = false;
|
||||
const prevNode = declaration.prev();
|
||||
|
||||
if (prevNode && prevNode.type === "comment") {
|
||||
const matched = prevNode.text.match(_utils.webpackIgnoreCommentRegexp);
|
||||
|
||||
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 null;
|
||||
}
|
||||
}
|
||||
|
||||
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])]);
|
||||
return { ...parsedDeclaration,
|
||||
url: resolvedUrl,
|
||||
hash
|
||||
};
|
||||
}));
|
||||
const results = await Promise.all(resolvedDeclarations);
|
||||
const urlToNameMap = new Map();
|
||||
const urlToReplacementMap = new Map();
|
||||
let hasUrlImportHelper = false;
|
||||
|
||||
for (let index = 0; index <= results.length - 1; index++) {
|
||||
const item = results[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
assets_old/node_modules/css-loader/dist/runtime/api.js
generated
vendored
Normal file
66
assets_old/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;
|
||||
};
|
32
assets_old/node_modules/css-loader/dist/runtime/cssWithMappingToString.js
generated
vendored
Normal file
32
assets_old/node_modules/css-loader/dist/runtime/cssWithMappingToString.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"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) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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 (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
assets_old/node_modules/css-loader/dist/runtime/getUrl.js
generated
vendored
Normal file
34
assets_old/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;
|
||||
};
|
651
assets_old/node_modules/css-loader/dist/utils.js
generated
vendored
Normal file
651
assets_old/node_modules/css-loader/dist/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,651 @@
|
|||
"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.webpackIgnoreCommentRegexp = void 0;
|
||||
|
||||
var _url = require("url");
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _loaderUtils = require("loader-utils");
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
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"));
|
||||
|
||||
var _camelcase = _interopRequireDefault(require("camelcase"));
|
||||
|
||||
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 whitespace = "[\\x20\\t\\r\\n\\f]";
|
||||
const unescapeRegExp = new RegExp(`\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, "ig");
|
||||
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
const webpackIgnoreCommentRegexp = /webpackIgnore:(\s+)?(true|false)/;
|
||||
exports.webpackIgnoreCommentRegexp = webpackIgnoreCommentRegexp;
|
||||
|
||||
function unescape(str) {
|
||||
return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
|
||||
const high = `0x${escaped}` - 0x10000;
|
||||
/* eslint-disable line-comment-position */
|
||||
// NaN means non-codepoint
|
||||
// Workaround erroneous numeric interpretation of +"0x"
|
||||
// eslint-disable-next-line no-self-compare
|
||||
|
||||
return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint
|
||||
String.fromCharCode(high + 0x10000) : // Supplemental Plane codepoint (surrogate pair)
|
||||
// eslint-disable-next-line no-bitwise
|
||||
String.fromCharCode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00);
|
||||
/* eslint-enable line-comment-position */
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
return (0, _cssesc.default)(localident // For `[hash]` placeholder
|
||||
.replace(/^((-?[0-9])|--)/, "_$1").replace(filenameReservedRegex, "-").replace(reControlChars, "-").replace(/\./g, "-"), {
|
||||
isIdentifier: true
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 (matchNativeWin32Path.test(url)) {
|
||||
return decodeURI(normalizedUrl);
|
||||
}
|
||||
|
||||
return decodeURI(unescape(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 (0, _camelcase.default)(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, options) {
|
||||
let code = "// Exports\n";
|
||||
let localsCode = "";
|
||||
|
||||
const addExportToLocalsCode = (name, value) => {
|
||||
if (options.modules.namedExport) {
|
||||
localsCode += `export const ${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 = (0, _camelcase.default)(name);
|
||||
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "camelCaseOnly":
|
||||
{
|
||||
addExportToLocalsCode((0, _camelcase.default)(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;
|
||||
}
|
||||
|
||||
if (localsCode) {
|
||||
code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {\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) && !matchNativeWin32Path.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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue