create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = resolveUrlLoader;
var _sourceMap = require("next/dist/compiled/source-map");
var _valueProcessor = _interopRequireDefault(require("./lib/value-processor"));
var _joinFunction = require("./lib/join-function");
var _postcss = _interopRequireDefault(require("./lib/postcss"));
async function resolveUrlLoader(content, sourceMap) {
const options = Object.assign({
sourceMap: this.sourceMap,
silent: false,
absolute: false,
keepQuery: false,
root: false,
debug: false,
join: _joinFunction.defaultJoin
}, this.getOptions());
let sourceMapConsumer;
if (sourceMap) {
sourceMapConsumer = new _sourceMap.SourceMapConsumer(sourceMap);
}
const callback = this.async();
const { postcss } = await options.postcss();
(0, _postcss).default(postcss, this.resourcePath, content, {
outputSourceMap: Boolean(options.sourceMap),
transformDeclaration: (0, _valueProcessor).default(this.resourcePath, options),
inputSourceMap: sourceMap,
sourceMapConsumer: sourceMapConsumer
}).catch(onFailure).then(onSuccess);
function onFailure(error) {
callback(encodeError("CSS error", error));
}
function onSuccess(reworked) {
if (reworked) {
// complete with source-map
// source-map sources are relative to the file being processed
if (options.sourceMap) {
callback(null, reworked.content, reworked.map);
} else {
callback(null, reworked.content);
}
}
}
function encodeError(label, exception) {
return new Error([
"resolve-url-loader",
": ",
[
label
].concat(typeof exception === "string" && exception || exception instanceof Error && [
exception.message,
exception.stack.split("\n")[1].trim(),
] || []).filter(Boolean).join("\n "),
].join(""));
}
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../build/webpack/loaders/resolve-url-loader/index.js"],"names":["resolveUrlLoader","content","sourceMap","options","Object","assign","silent","absolute","keepQuery","root","debug","join","defaultJoin","getOptions","sourceMapConsumer","SourceMapConsumer","callback","async","postcss","process","resourcePath","outputSourceMap","Boolean","transformDeclaration","valueProcessor","inputSourceMap","catch","onFailure","then","onSuccess","error","encodeError","reworked","map","label","exception","Error","concat","message","stack","split","trim","filter"],"mappings":"AAwBA;;;;kBAW8BA,gBAAgB;AAXZ,IAAA,UAA+B,WAA/B,+BAA+B,CAAA;AACtC,IAAA,eAAuB,kCAAvB,uBAAuB,EAAA;AACtB,IAAA,aAAqB,WAArB,qBAAqB,CAAA;AAC7B,IAAA,QAAe,kCAAf,eAAe,EAAA;AAQpB,eAAeA,gBAAgB,CAACC,OAAO,EAAEC,SAAS,EAAE;IACjE,MAAMC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAC3B;QACEH,SAAS,EAAE,IAAI,CAACA,SAAS;QACzBI,MAAM,EAAE,KAAK;QACbC,QAAQ,EAAE,KAAK;QACfC,SAAS,EAAE,KAAK;QAChBC,IAAI,EAAE,KAAK;QACXC,KAAK,EAAE,KAAK;QACZC,IAAI,EAAEC,aAAW,YAAA;KAClB,EACD,IAAI,CAACC,UAAU,EAAE,CAClB;IAED,IAAIC,iBAAiB;IACrB,IAAIZ,SAAS,EAAE;QACbY,iBAAiB,GAAG,IAAIC,UAAiB,kBAAA,CAACb,SAAS,CAAC;KACrD;IAED,MAAMc,QAAQ,GAAG,IAAI,CAACC,KAAK,EAAE;IAC7B,MAAM,EAAEC,OAAO,CAAA,EAAE,GAAG,MAAMf,OAAO,CAACe,OAAO,EAAE;IAC3CC,CAAAA,GAAAA,QAAO,AAKL,CAAA,QALK,CAACD,OAAO,EAAE,IAAI,CAACE,YAAY,EAAEnB,OAAO,EAAE;QAC3CoB,eAAe,EAAEC,OAAO,CAACnB,OAAO,CAACD,SAAS,CAAC;QAC3CqB,oBAAoB,EAAEC,CAAAA,GAAAA,eAAc,AAA4B,CAAA,QAA5B,CAAC,IAAI,CAACJ,YAAY,EAAEjB,OAAO,CAAC;QAChEsB,cAAc,EAAEvB,SAAS;QACzBY,iBAAiB,EAAEA,iBAAiB;KACrC,CAAC,CACCY,KAAK,CAACC,SAAS,CAAC,CAChBC,IAAI,CAACC,SAAS,CAAC;IAElB,SAASF,SAAS,CAACG,KAAK,EAAE;QACxBd,QAAQ,CAACe,WAAW,CAAC,WAAW,EAAED,KAAK,CAAC,CAAC;KAC1C;IAED,SAASD,SAAS,CAACG,QAAQ,EAAE;QAC3B,IAAIA,QAAQ,EAAE;YACZ,2BAA2B;YAC3B,+DAA+D;YAC/D,IAAI7B,OAAO,CAACD,SAAS,EAAE;gBACrBc,QAAQ,CAAC,IAAI,EAAEgB,QAAQ,CAAC/B,OAAO,EAAE+B,QAAQ,CAACC,GAAG,CAAC;aAC/C,MAEI;gBACHjB,QAAQ,CAAC,IAAI,EAAEgB,QAAQ,CAAC/B,OAAO,CAAC;aACjC;SACF;KACF;IAED,SAAS8B,WAAW,CAACG,KAAK,EAAEC,SAAS,EAAE;QACrC,OAAO,IAAIC,KAAK,CACd;YACE,oBAAoB;YACpB,IAAI;YACJ;gBAACF,KAAK;aAAC,CACJG,MAAM,CACL,AAAC,OAAOF,SAAS,KAAK,QAAQ,IAAIA,SAAS,IACxCA,SAAS,YAAYC,KAAK,IAAI;gBAC7BD,SAAS,CAACG,OAAO;gBACjBH,SAAS,CAACI,KAAK,CAACC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,EAAE;aACtC,IACD,EAAE,CACL,CACAC,MAAM,CAACpB,OAAO,CAAC,CACfX,IAAI,CAAC,MAAM,CAAC;SAChB,CAACA,IAAI,CAAC,EAAE,CAAC,CACX,CAAA;KACF;CACF"}

View File

@@ -0,0 +1,53 @@
"use strict";
/*
The MIT License (MIT)
Copyright (c) 2016 Ben Holloway
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.
*/ /**
* Prepend file:// protocol to source path string or source-map sources.
*/ function prepend(candidate) {
if (typeof candidate === "string") {
return "file://" + candidate;
} else if (candidate && typeof candidate === "object" && Array.isArray(candidate.sources)) {
return Object.assign({}, candidate, {
sources: candidate.sources.map(prepend)
});
} else {
throw new Error("expected string|object");
}
}
exports.prepend = prepend;
/**
* Remove file:// protocol from source path string or source-map sources.
*/ function remove(candidate) {
if (typeof candidate === "string") {
return candidate.replace(/^file:\/{2}/, "");
} else if (candidate && typeof candidate === "object" && Array.isArray(candidate.sources)) {
return Object.assign({}, candidate, {
sources: candidate.sources.map(remove)
});
} else {
throw new Error("expected string|object");
}
}
exports.remove = remove;
//# sourceMappingURL=file-protocol.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../build/webpack/loaders/resolve-url-loader/lib/file-protocol.js"],"names":["prepend","candidate","Array","isArray","sources","Object","assign","map","Error","exports","remove","replace"],"mappings":"AA2BA;AA3BA;;;;;;;;;;;;;;;;;;;;;;EAsBE,CAEF;;GAEG,CACH,SAASA,OAAO,CAACC,SAAS,EAAE;IAC1B,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;QACjC,OAAO,SAAS,GAAGA,SAAS,CAAA;KAC7B,MAAM,IACLA,SAAS,IACT,OAAOA,SAAS,KAAK,QAAQ,IAC7BC,KAAK,CAACC,OAAO,CAACF,SAAS,CAACG,OAAO,CAAC,EAChC;QACA,OAAOC,MAAM,CAACC,MAAM,CAAC,EAAE,EAAEL,SAAS,EAAE;YAClCG,OAAO,EAAEH,SAAS,CAACG,OAAO,CAACG,GAAG,CAACP,OAAO,CAAC;SACxC,CAAC,CAAA;KACH,MAAM;QACL,MAAM,IAAIQ,KAAK,CAAC,wBAAwB,CAAC,CAAA;KAC1C;CACF;AAEDC,OAAO,CAACT,OAAO,GAAGA,OAAO;AAEzB;;GAEG,CACH,SAASU,MAAM,CAACT,SAAS,EAAE;IACzB,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;QACjC,OAAOA,SAAS,CAACU,OAAO,gBAAgB,EAAE,CAAC,CAAA;KAC5C,MAAM,IACLV,SAAS,IACT,OAAOA,SAAS,KAAK,QAAQ,IAC7BC,KAAK,CAACC,OAAO,CAACF,SAAS,CAACG,OAAO,CAAC,EAChC;QACA,OAAOC,MAAM,CAACC,MAAM,CAAC,EAAE,EAAEL,SAAS,EAAE;YAClCG,OAAO,EAAEH,SAAS,CAACG,OAAO,CAACG,GAAG,CAACG,MAAM,CAAC;SACvC,CAAC,CAAA;KACH,MAAM;QACL,MAAM,IAAIF,KAAK,CAAC,wBAAwB,CAAC,CAAA;KAC1C;CACF;AAEDC,OAAO,CAACC,MAAM,GAAGA,MAAM"}

View File

@@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.defaultJoin = void 0;
var _path = _interopRequireDefault(require("path"));
var _fs = _interopRequireDefault(require("fs"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const compose = (f, g)=>(...args)=>f(g(...args));
const simpleJoin = compose(_path.default.normalize, _path.default.join);
const defaultJoin = createJoinForPredicate(function predicate(_, uri, base, i, next) {
const absolute = simpleJoin(base, uri);
return _fs.default.existsSync(absolute) ? absolute : next(i === 0 ? absolute : null);
}, "defaultJoin");
exports.defaultJoin = defaultJoin;
function* createIterator(arr) {
for (const i of arr){
yield i;
}
}
/**
* Define a join function by a predicate that tests possible base paths from an iterator.
*
* The `predicate` is of the form:
*
* ```
* function(filename, uri, base, i, next):string|null
* ```
*
* Given the uri and base it should either return:
* - an absolute path success
* - a call to `next(null)` as failure
* - a call to `next(absolute)` where absolute is placeholder and the iterator continues
*
* The value given to `next(...)` is only used if success does not eventually occur.
*
* The `file` value is typically unused but useful if you would like to differentiate behaviour.
*
* You can write a much simpler function than this if you have specific requirements.
*
* @param {function} predicate A function that tests values
* @param {string} [name] Optional name for the resulting join function
*/ function createJoinForPredicate(predicate, name) {
/**
* A factory for a join function with logging.
*
* @param {string} filename The current file being processed
* @param {{debug:function|boolean,root:string}} options An options hash
*/ function join(filename, options) {
const log = createDebugLogger(options.debug);
/**
* Join function proper.
*
* For absolute uri only `uri` will be provided. In this case we substitute any `root` given in options.
*
* @param {string} uri A uri path, relative or absolute
* @param {string|Iterator.<string>} [baseOrIteratorOrAbsent] Optional absolute base path or iterator thereof
* @return {string} Just the uri where base is empty or the uri appended to the base
*/ return function joinProper(uri, baseOrIteratorOrAbsent) {
const iterator = typeof baseOrIteratorOrAbsent === "undefined" && createIterator([
options.root
]) || typeof baseOrIteratorOrAbsent === "string" && createIterator([
baseOrIteratorOrAbsent
]) || baseOrIteratorOrAbsent;
const result = runIterator([]);
log(createJoinMsg, [
filename,
uri,
result,
result.isFound
]);
return typeof result.absolute === "string" ? result.absolute : uri;
function runIterator(accumulator) {
const nextItem = iterator.next();
var base = !nextItem.done && nextItem.value;
if (typeof base === "string") {
const element = predicate(filename, uri, base, accumulator.length, next);
if (typeof element === "string" && _path.default.isAbsolute(element)) {
return Object.assign(accumulator.concat(base), {
isFound: true,
absolute: element
});
} else if (Array.isArray(element)) {
return element;
} else {
throw new Error("predicate must return an absolute path or the result of calling next()");
}
} else {
return accumulator;
}
function next(fallback) {
return runIterator(Object.assign(accumulator.concat(base), typeof fallback === "string" && {
absolute: fallback
}));
}
}
};
}
function toString() {
return "[Function: " + name + "]";
}
return Object.assign(join, name && {
valueOf: toString,
toString: toString
});
}
/**
* Format a debug message.
*
* @param {string} file The file being processed by webpack
* @param {string} uri A uri path, relative or absolute
* @param {Array.<string>} bases Absolute base paths up to and including the found one
* @param {boolean} isFound Indicates the last base was correct
* @return {string} Formatted message
*/ function createJoinMsg(file, uri, bases, isFound) {
return [
"resolve-url-loader: " + pathToString(file) + ": " + uri
].concat(bases.map(pathToString).filter(Boolean)).concat(isFound ? "FOUND" : "NOT FOUND").join("\n ");
/**
* If given path is within `process.cwd()` then show relative posix path, otherwise show absolute posix path.
*
* @param {string} absolute An absolute path
* @return {string} A relative or absolute path
*/ function pathToString(absolute) {
if (!absolute) {
return null;
} else {
const relative = _path.default.relative(process.cwd(), absolute).split(_path.default.sep);
return (relative[0] === ".." ? absolute.split(_path.default.sep) : [
"."
].concat(relative).filter(Boolean)).join("/");
}
}
}
exports.createJoinMsg = createJoinMsg;
/**
* A factory for a log function predicated on the given debug parameter.
*
* The logging function created accepts a function that formats a message and parameters that the function utilises.
* Presuming the message function may be expensive we only call it if logging is enabled.
*
* The log messages are de-duplicated based on the parameters, so it is assumed they are simple types that stringify
* well.
*
* @param {function|boolean} debug A boolean or debug function
* @return {function(function, array)} A logging function possibly degenerate
*/ function createDebugLogger(debug) {
const log = !!debug && (typeof debug === "function" ? debug : console.log);
const cache = {};
return log ? actuallyLog : noop;
function noop() {}
function actuallyLog(msgFn, params) {
const key = JSON.stringify(params);
if (!cache[key]) {
cache[key] = true;
log(msgFn.apply(null, params));
}
}
}
exports.createDebugLogger = createDebugLogger;
//# sourceMappingURL=join-function.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../build/webpack/loaders/resolve-url-loader/lib/join-function.js"],"names":["compose","f","g","args","simpleJoin","path","normalize","join","defaultJoin","createJoinForPredicate","predicate","_","uri","base","i","next","absolute","fs","existsSync","createIterator","arr","name","filename","options","log","createDebugLogger","debug","joinProper","baseOrIteratorOrAbsent","iterator","root","result","runIterator","createJoinMsg","isFound","accumulator","nextItem","done","value","element","length","isAbsolute","Object","assign","concat","Array","isArray","Error","fallback","toString","valueOf","file","bases","pathToString","map","filter","Boolean","relative","process","cwd","split","sep","exports","console","cache","actuallyLog","noop","msgFn","params","key","JSON","stringify","apply"],"mappings":"AAuBA;;;;;AAAiB,IAAA,KAAM,kCAAN,MAAM,EAAA;AACR,IAAA,GAAI,kCAAJ,IAAI,EAAA;;;;;;AAEnB,MAAMA,OAAO,GACX,CAACC,CAAC,EAAEC,CAAC,GACL,CAAIC,GAAAA,IAAI,GACNF,CAAC,CAACC,CAAC,IAAIC,IAAI,CAAC,CAAC;AAEjB,MAAMC,UAAU,GAAGJ,OAAO,CAACK,KAAI,QAAA,CAACC,SAAS,EAAED,KAAI,QAAA,CAACE,IAAI,CAAC;AAS9C,MAAMC,WAAW,GAAGC,sBAAsB,CAAC,SAASC,SAAS,CAClEC,CAAC,EACDC,GAAG,EACHC,IAAI,EACJC,CAAC,EACDC,IAAI,EACJ;IACA,MAAMC,QAAQ,GAAGZ,UAAU,CAACS,IAAI,EAAED,GAAG,CAAC;IACtC,OAAOK,GAAE,QAAA,CAACC,UAAU,CAACF,QAAQ,CAAC,GAAGA,QAAQ,GAAGD,IAAI,CAACD,CAAC,KAAK,CAAC,GAAGE,QAAQ,GAAG,IAAI,CAAC,CAAA;CAC5E,EACD,aAAa,CAAC;QAVDR,WAAW,GAAXA,WAAW;AAYxB,UAAUW,cAAc,CAACC,GAAG,EAAE;IAC5B,KAAK,MAAMN,CAAC,IAAIM,GAAG,CAAE;QACnB,MAAMN,CAAC;KACR;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG,CACH,SAASL,sBAAsB,CAACC,SAAS,EAAEW,IAAI,EAAE;IAC/C;;;;;KAKG,CACH,SAASd,IAAI,CAACe,QAAQ,EAAEC,OAAO,EAAE;QAC/B,MAAMC,GAAG,GAAGC,iBAAiB,CAACF,OAAO,CAACG,KAAK,CAAC;QAE5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ACvD,KAAI,QAAA,CAACwD,GAAG,CAAC;YAEvE,OAAO,CACLJ,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,GAChBzC,QAAQ,CAAC4C,KAAK,CAACvD,KAAI,QAAA,CAACwD,GAAG,CAAC,GACxB;gBAAC,GAAG;aAAC,CAACjB,MAAM,CAACa,QAAQ,CAAC,CAACF,MAAM,CAACC,OAAO,CAAC,CAC3C,CAACjD,IAAI,CAAC,GAAG,CAAC,CAAA;SACZ;KACF;CACF;AAEDuD,OAAO,CAAC7B,aAAa,GAAGA,aAAa;AAErC;;;;;;;;;;;GAWG,CACH,SAASR,iBAAiB,CAACC,KAAK,EAAE;IAChC,MAAMF,GAAG,GAAG,CAAC,CAACE,KAAK,IAAI,CAAC,OAAOA,KAAK,KAAK,UAAU,GAAGA,KAAK,GAAGqC,OAAO,CAACvC,GAAG,CAAC;IAC1E,MAAMwC,KAAK,GAAG,EAAE;IAChB,OAAOxC,GAAG,GAAGyC,WAAW,GAAGC,IAAI,CAAA;IAE/B,SAASA,IAAI,GAAG,EAAE;IAElB,SAASD,WAAW,CAACE,KAAK,EAAEC,MAAM,EAAE;QAClC,MAAMC,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACH,MAAM,CAAC;QAClC,IAAI,CAACJ,KAAK,CAACK,GAAG,CAAC,EAAE;YACfL,KAAK,CAACK,GAAG,CAAC,GAAG,IAAI;YACjB7C,GAAG,CAAC2C,KAAK,CAACK,KAAK,CAAC,IAAI,EAAEJ,MAAM,CAAC,CAAC;SAC/B;KACF;CACF;AAEDN,OAAO,CAACrC,iBAAiB,GAAGA,iBAAiB"}

View File

@@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = process;
var _path = _interopRequireDefault(require("path"));
var _fileProtocol = _interopRequireDefault(require("./file-protocol"));
function process(postcss, sourceFile, sourceContent, params) {
// #107 libsass emits orphan CR not considered newline, postcss does consider newline (content vs source-map mismatch)
// prepend file protocol to all sources to avoid problems with source map
return postcss([
postcss.plugin("postcss-resolve-url", postcssPlugin)
]).process(sourceContent, {
from: _fileProtocol.default.prepend(sourceFile),
map: params.outputSourceMap && {
prev: !!params.inputSourceMap && _fileProtocol.default.prepend(params.inputSourceMap),
inline: false,
annotation: false,
sourcesContent: true
}
}).then((result)=>({
content: result.css,
map: params.outputSourceMap ? _fileProtocol.default.remove(result.map.toJSON()) : null
}));
/**
* Plugin for postcss that follows SASS transpilation.
*/ function postcssPlugin() {
return function(styles) {
styles.walkDecls(eachDeclaration);
};
/**
* Process a declaration from the syntax tree.
* @param declaration
*/ function eachDeclaration(declaration) {
const isValid = declaration.value && declaration.value.indexOf("url") >= 0;
if (isValid) {
// reverse the original source-map to find the original source file before transpilation
const startPosApparent = declaration.source.start, startPosOriginal = params.sourceMapConsumer && params.sourceMapConsumer.originalPositionFor(startPosApparent);
// we require a valid directory for the specified file
const directory = startPosOriginal && startPosOriginal.source && _fileProtocol.default.remove(_path.default.dirname(startPosOriginal.source));
if (directory) {
declaration.value = params.transformDeclaration(declaration.value, directory);
} else if (params.sourceMapConsumer) {
throw new Error("source-map information is not available at url() declaration " + (ORPHAN_CR_REGEX.test(sourceContent) ? "(found orphan CR, try removeCR option)" : "(no orphan CR found)"));
}
}
}
}
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const ORPHAN_CR_REGEX = /\r(?!\n)(.|\n)?/g;
//# sourceMappingURL=postcss.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../build/webpack/loaders/resolve-url-loader/lib/postcss.js"],"names":["process","postcss","sourceFile","sourceContent","params","plugin","postcssPlugin","from","fileProtocol","prepend","map","outputSourceMap","prev","inputSourceMap","inline","annotation","sourcesContent","then","result","content","css","remove","toJSON","styles","walkDecls","eachDeclaration","declaration","isValid","value","indexOf","startPosApparent","source","start","startPosOriginal","sourceMapConsumer","originalPositionFor","directory","path","dirname","transformDeclaration","Error","ORPHAN_CR_REGEX","test"],"m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gB,GAAGJ,WAAW,CAACK,MAAM,CAACC,KAAK,EAC/CC,gBAAgB,GACd7B,MAAM,CAAC8B,iBAAiB,IACxB9B,MAAM,CAAC8B,iBAAiB,CAACC,mBAAmB,CAACL,gBAAgB,CAAC;gBAElE,sDAAsD;gBACtD,MAAMM,SAAS,GACbH,gBAAgB,IAChBA,gBAAgB,CAACF,MAAM,IACvBvB,aAAY,QAAA,CAACa,MAAM,CAACgB,KAAI,QAAA,CAACC,OAAO,CAACL,gBAAgB,CAACF,MAAM,CAAC,CAAC;gBAC5D,IAAIK,SAAS,EAAE;oBACbV,WAAW,CAACE,KAAK,GAAGxB,MAAM,CAACmC,oBAAoB,CAC7Cb,WAAW,CAACE,KAAK,EACjBQ,SAAS,CACV;iBACF,MAEI,IAAIhC,MAAM,CAAC8B,iBAAiB,EAAE;oBACjC,MAAM,IAAIM,KAAK,CACb,+DAA+D,GAC7D,CAACC,eAAe,CAACC,IAAI,CAACvC,aAAa,CAAC,GAChC,wCAAwC,GACxC,sBAAsB,CAAC,CAC9B,CAAA;iBACF;aACF;SACF;KACF;CACF;;;;;;AArED,MAAMsC,eAAe,qBAAqB"}

View File

@@ -0,0 +1,70 @@
"use strict";
var _loaderUtils2 = _interopRequireDefault(require("next/dist/compiled/loader-utils2"));
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function valueProcessor(filename, options) {
const URL_STATEMENT_REGEX = /(url\s*\()\s*(?:(['"])((?:(?!\2).)*)(\2)|([^'"](?:(?!\)).)*[^'"]))\s*(\))/g;
const directory = _path.default.dirname(filename);
const join = options.join(filename, options);
/**
* Process the given CSS declaration value.
*
* @param {string} value A declaration value that may or may not contain a url() statement
* @param {string|Iterator.<string>} candidate An absolute path that may be the correct base or an Iterator thereof
*/ return function transformValue(value, candidate) {
// allow multiple url() values in the declaration
// split by url statements and process the content
// additional capture groups are needed to match quotations correctly
// escaped quotations are not considered
return value.split(URL_STATEMENT_REGEX).map((token, i, arr)=>{
// we can get groups as undefined under certain match circumstances
const initialised = token || "";
// the content of the url() statement is either in group 3 or group 5
const mod = i % 7;
if (mod === 3 || mod === 5) {
// detect quoted url and unescape backslashes
const before = arr[i - 1], after = arr[i + 1], isQuoted = before === after && (before === "'" || before === '"'), unescaped = isQuoted ? initialised.replace(/\\{2}/g, "\\") : initialised;
// split into uri and query/hash and then find the absolute path to the uri
const split = unescaped.split(/([?#])/g), uri = split[0], absolute = testIsRelative(uri) && join(uri, candidate) || testIsAbsolute(uri) && join(uri), query = options.keepQuery ? split.slice(1).join("") : "";
// use the absolute path in absolute mode or else relative path (or default to initialised)
// #6 - backslashes are not legal in URI
if (!absolute) {
return initialised;
} else if (options.absolute) {
return absolute.replace(/\\/g, "/") + query;
} else {
return _loaderUtils2.default.urlToRequest(_path.default.relative(directory, absolute).replace(/\\/g, "/") + query);
}
} else {
return initialised;
}
}).join("");
};
/**
* The loaderUtils.isUrlRequest() doesn't support windows absolute paths on principle. We do not subscribe to that
* dogma so we add path.isAbsolute() check to allow them.
*
* We also eliminate module relative (~) paths.
*
* @param {string|undefined} uri A uri string possibly empty or undefined
* @return {boolean} True for relative uri
*/ function testIsRelative(uri) {
return !!uri && _loaderUtils2.default.isUrlRequest(uri, false) && !_path.default.isAbsolute(uri) && uri.indexOf("~") !== 0;
}
/**
* The loaderUtils.isUrlRequest() doesn't support windows absolute paths on principle. We do not subscribe to that
* dogma so we add path.isAbsolute() check to allow them.
*
* @param {string|undefined} uri A uri string possibly empty or undefined
* @return {boolean} True for absolute uri
*/ function testIsAbsolute(uri) {
return !!uri && typeof options.root === "string" && _loaderUtils2.default.isUrlRequest(uri, options.root) && (/^\//.test(uri) || _path.default.isAbsolute(uri));
}
}
module.exports = valueProcessor;
//# sourceMappingURL=value-processor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../build/webpack/loaders/resolve-url-loader/lib/value-processor.js"],"names":["valueProcessor","filename","options","URL_STATEMENT_REGEX","directory","path","dirname","join","transformValue","value","candidate","split","map","token","i","arr","initialised","mod","before","after","isQuoted","unescaped","replace","uri","absolute","testIsRelative","testIsAbsolute","query","keepQuery","slice","loaderUtils","urlToRequest","relative","isUrlRequest","isAbsolute","indexOf","root","test","module","exports"],"mappings":"AAwBA;AAAwB,IAAA,aAAkC,kCAAlC,kCAAkC,EAAA;AACzC,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEvB,SAASA,cAAc,CAACC,QAAQ,EAAEC,OAAO,EAAE;IACzC,MAAMC,mBAAmB,+EACqD;IAC9E,MAAMC,SAAS,GAAGC,KAAI,QAAA,CAACC,OAAO,CAACL,QAAQ,CAAC;IACxC,MAAMM,IAAI,GAAGL,OAAO,CAACK,IAAI,CAACN,QAAQ,EAAEC,OAAO,CAAC;IAE5C;;;;;KAKG,CACH,OAAO,SAASM,cAAc,CAACC,KAAK,EAAEC,SAAS,EAAE;QAC/C,iDAAiD;QACjD,mDAAmD;QACnD,sEAAsE;QACtE,yCAAyC;QACzC,OAAOD,KAAK,CACTE,KAAK,CAACR,mBAAmB,CAAC,CAC1BS,GAAG,CAAC,CAACC,KAAK,EAAEC,CAAC,EAAEC,GAAG,GAAK;YACtB,mEAAmE;YACnE,MAAMC,WAAW,GAAGH,KAAK,IAAI,EAAE;YAE/B,qEAAqE;YACrE,MAAMI,GAAG,GAAGH,CAAC,GAAG,CAAC;YACjB,IAAIG,GAAG,KAAK,CAAC,IAAIA,GAAG,KAAK,CAAC,EAAE;gBAC1B,6CAA6C;gBAC7C,MAAMC,MAAM,GAAGH,GAAG,CAACD,CAAC,GAAG,CAAC,CAAC,EACvBK,KAAK,GAAGJ,GAAG,CAACD,CAAC,GAAG,CAAC,CAAC,EAClBM,QAAQ,GAAGF,MAAM,KAAKC,KAAK,IAAI,CAACD,MAAM,KAAK,GAAG,IAAIA,MAAM,KAAK,GAAG,CAAC,EACjEG,SAAS,GAAGD,QAAQ,GAChBJ,WAAW,CAACM,OAAO,WAAW,IA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