Initial boiler plate project
This commit is contained in:
85
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/index.js
generated
vendored
Normal file
85
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
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.
|
||||
*/ import { SourceMapConsumer } from "next/dist/compiled/source-map";
|
||||
import valueProcessor from "./lib/value-processor";
|
||||
import { defaultJoin } from "./lib/join-function";
|
||||
import process from "./lib/postcss";
|
||||
/**
|
||||
* A webpack loader that resolves absolute url() paths relative to their original source file.
|
||||
* Requires source-maps to do any meaningful work.
|
||||
*/ export default async function resolveUrlLoader(/** Css content */ content, /** The source-map */ sourceMap) {
|
||||
const options = Object.assign({
|
||||
sourceMap: this.sourceMap,
|
||||
silent: false,
|
||||
absolute: false,
|
||||
keepQuery: false,
|
||||
root: false,
|
||||
debug: false,
|
||||
join: defaultJoin
|
||||
}, this.getOptions());
|
||||
let sourceMapConsumer;
|
||||
if (sourceMap) {
|
||||
sourceMapConsumer = new SourceMapConsumer(sourceMap);
|
||||
}
|
||||
const callback = this.async();
|
||||
const { postcss } = options.postcss ? await options.postcss() : {
|
||||
postcss: require("postcss")
|
||||
};
|
||||
process(postcss, this.resourcePath, content, {
|
||||
outputSourceMap: Boolean(options.sourceMap),
|
||||
transformDeclaration: valueProcessor(this.resourcePath, options),
|
||||
inputSourceMap: sourceMap,
|
||||
sourceMapConsumer: sourceMapConsumer
|
||||
})// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
.catch(onFailure)// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
.then(onSuccess);
|
||||
function onFailure(error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
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", 2)[1].trim()
|
||||
] || []).filter(Boolean).join("\n ")
|
||||
].join(""));
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/resolve-url-loader/index.ts"],"names":["SourceMapConsumer","valueProcessor","defaultJoin","process","resolveUrlLoader","content","sourceMap","options","Object","assign","silent","absolute","keepQuery","root","debug","join","getOptions","sourceMapConsumer","callback","async","postcss","require","resourcePath","outputSourceMap","Boolean","transformDeclaration","inputSourceMap","catch","onFailure","then","onSuccess","error","encodeError","reworked","map","label","exception","Error","concat","message","stack","split","trim","filter"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GAEA,SAASA,iBAAiB,QAAQ,gCAA+B;AACjE,OAAOC,oBAAoB,wBAAuB;AAClD,SAASC,WAAW,QAAQ,sBAAqB;AACjD,OAAOC,aAAa,gBAAe;AACnC;;;CAGC,GACD,eAAe,eAAeC,iBAE5B,gBAAgB,GAChBC,OAAe,EACf,mBAAmB,GACnBC,SAAc;IAEd,MAAMC,UAAUC,OAAOC,MAAM,CAC3B;QACEH,WAAW,IAAI,CAACA,SAAS;QACzBI,QAAQ;QACRC,UAAU;QACVC,WAAW;QACXC,MAAM;QACNC,OAAO;QACPC,MAAMb;IACR,GACA,IAAI,CAACc,UAAU;IAGjB,IAAIC;IACJ,IAAIX,WAAW;QACbW,oBAAoB,IAAIjB,kBAAkBM;IAC5C;IAEA,MAAMY,WAAW,IAAI,CAACC,KAAK;IAC3B,MAAM,EAAEC,OAAO,EAAE,GAAGb,QAAQa,OAAO,GAC/B,MAAMb,QAAQa,OAAO,KACrB;QAAEA,SAASC,QAAQ;IAAW;IAClClB,QAAQiB,SAAS,IAAI,CAACE,YAAY,EAAEjB,SAAS;QAC3CkB,iBAAiBC,QAAQjB,QAAQD,SAAS;QAC1CmB,sBAAsBxB,eAAe,IAAI,CAACqB,YAAY,EAAEf;QACxDmB,gBAAgBpB;QAChBW,mBAAmBA;IACrB,EACE,mEAAmE;KAClEU,KAAK,CAACC,UACP,mEAAmE;KAClEC,IAAI,CAACC;IAER,SAASF,UAAUG,KAAY;QAC7B,mEAAmE;QACnEb,SAASc,YAAY,aAAaD;IACpC;IAEA,SAASD,UAAUG,QAAa;QAC9B,IAAIA,UAAU;YACZ,2BAA2B;YAC3B,+DAA+D;YAC/D,IAAI1B,QAAQD,SAAS,EAAE;gBACrBY,SAAS,MAAMe,SAAS5B,OAAO,EAAE4B,SAASC,GAAG;YAC/C,OAEK;gBACHhB,SAAS,MAAMe,SAAS5B,OAAO;YACjC;QACF;IACF;IAEA,SAAS2B,YAAYG,KAAU,EAAEC,SAAc;QAC7C,OAAO,IAAIC,MACT;YACE;YACA;YACA;gBAACF;aAAM,CACJG,MAAM,CACL,AAAC,OAAOF,cAAc,YAAYA,aAC/BA,qBAAqBC,SAAS;gBAC7BD,UAAUG,OAAO;gBAChBH,UAAkBI,KAAK,CAACC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,CAACC,IAAI;aAChD,IACD,EAAE,EAELC,MAAM,CAACnB,SACPT,IAAI,CAAC;SACT,CAACA,IAAI,CAAC;IAEX;AACF"}
|
||||
50
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js
generated
vendored
Normal file
50
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
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.
|
||||
*/ export 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");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Remove file:// protocol from source path string or source-map sources.
|
||||
*/ export 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");
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=file-protocol.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/resolve-url-loader/lib/file-protocol.ts"],"names":["prepend","candidate","Array","isArray","sources","Object","assign","map","Error","remove","replace"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GAEA;;CAEC,GACD,OAAO,SAASA,QAAQC,SAAc;IACpC,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAO,YAAYA;IACrB,OAAO,IACLA,aACA,OAAOA,cAAc,YACrBC,MAAMC,OAAO,CAACF,UAAUG,OAAO,GAC/B;QACA,OAAOC,OAAOC,MAAM,CAAC,CAAC,GAAGL,WAAW;YAClCG,SAASH,UAAUG,OAAO,CAACG,GAAG,CAACP;QACjC;IACF,OAAO;QACL,MAAM,IAAIQ,MAAM;IAClB;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,OAAOR,SAAc;IACnC,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAOA,UAAUS,OAAO,CAAC,eAAe;IAC1C,OAAO,IACLT,aACA,OAAOA,cAAc,YACrBC,MAAMC,OAAO,CAACF,UAAUG,OAAO,GAC/B;QACA,OAAOC,OAAOC,MAAM,CAAC,CAAC,GAAGL,WAAW;YAClCG,SAASH,UAAUG,OAAO,CAACG,GAAG,CAACE;QACjC;IACF,OAAO;QACL,MAAM,IAAID,MAAM;IAClB;AACF"}
|
||||
177
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/join-function.js
generated
vendored
Normal file
177
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/join-function.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
// TODO: Remove use of `any` type. Fix no-use-before-define violations.
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */ /*
|
||||
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.
|
||||
*/ import path from "path";
|
||||
import fs from "fs";
|
||||
const compose = (f, g)=>(...args)=>f(g(...args));
|
||||
const simpleJoin = compose(path.normalize, path.join);
|
||||
/**
|
||||
* The default join function iterates over possible base paths until a suitable join is found.
|
||||
*
|
||||
* The first base path is used as fallback for the case where none of the base paths can locate the actual file.
|
||||
*
|
||||
* @type {function}
|
||||
*/ export const defaultJoin = createJoinForPredicate(function predicate(_, uri, base, i, next) {
|
||||
const absolute = simpleJoin(base, uri);
|
||||
return fs.existsSync(absolute) ? absolute : next(i === 0 ? absolute : null);
|
||||
}, "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.
|
||||
*
|
||||
*/ function createJoinForPredicate(/** predicate A function that tests values */ predicate, /** Optional name for the resulting join function */ name) {
|
||||
/**
|
||||
* A factory for a join function with logging.
|
||||
*/ function join(/** The current file being processed */ filename, /** An options hash */ 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.
|
||||
*
|
||||
* Returns Just the uri where base is empty or the uri appended to the base
|
||||
*/ return function joinProper(/** A uri path, relative or absolute */ uri, /** Optional absolute base path or iterator thereof */ 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.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.
|
||||
* Return Formatted message
|
||||
*/ function createJoinMsg(/** The file being processed by webpack */ file, /** A uri path, relative or absolute */ uri, /** Absolute base paths up to and including the found one */ bases, /** Indicates the last base was correct */ isFound) {
|
||||
return [
|
||||
"resolve-url-loader: " + pathToString(file) + ": " + uri,
|
||||
//
|
||||
...bases.map(pathToString).filter(Boolean),
|
||||
...isFound ? [
|
||||
"FOUND"
|
||||
] : [
|
||||
"NOT FOUND"
|
||||
]
|
||||
].join("\n ");
|
||||
/**
|
||||
* If given path is within `process.cwd()` then show relative posix path, otherwise show absolute posix path.
|
||||
*
|
||||
* Returns A relative or absolute path
|
||||
*/ function pathToString(/** An absolute path */ absolute) {
|
||||
if (!absolute) {
|
||||
return null;
|
||||
} else {
|
||||
const relative = path.relative(process.cwd(), absolute).split(path.sep);
|
||||
return (relative[0] === ".." ? absolute.split(path.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.
|
||||
*
|
||||
* Returns A logging function possibly degenerate
|
||||
*/ function createDebugLogger(/** A boolean or debug function */ 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
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/join-function.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/join-function.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/resolve-url-loader/lib/join-function.ts"],"names":["path","fs","compose","f","g","args","simpleJoin","normalize","join","defaultJoin","createJoinForPredicate","predicate","_","uri","base","i","next","absolute","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":"AAAA,uEAAuE;AACvE,0DAA0D,GAC1D;;;;;;;;;;;;;;;;;;;;;;AAsBA,GACA,OAAOA,UAAU,OAAM;AACvB,OAAOC,QAAQ,KAAI;AAEnB,MAAMC,UACJ,CAACC,GAAQC,IACT,CAAC,GAAGC,OACFF,EAAEC,KAAKC;AAEX,MAAMC,aAAaJ,QAAQF,KAAKO,SAAS,EAAEP,KAAKQ,IAAI;AAEpD;;;;;;CAMC,GACD,OAAO,MAAMC,cAAcC,uBAAuB,SAASC,UACzDC,CAAM,EACNC,GAAQ,EACRC,IAAS,EACTC,CAAM,EACNC,IAAS;IAET,MAAMC,WAAWX,WAAWQ,MAAMD;IAClC,OAAOZ,GAAGiB,UAAU,CAACD,YAAYA,WAAWD,KAAKD,MAAM,IAAIE,WAAW;AACxE,GACA,eAAc;AAEd,UAAUE,eAAeC,GAAQ;IAC/B,KAAK,MAAML,KAAKK,IAAK;QACnB,MAAML;IACR;AACF;AAEA;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,SAASL,uBACP,2CAA2C,GAC3CC,SAAc,EACd,kDAAkD,GAClDU,IAAY;IAEZ;;G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EAAE;YACfL,KAAK,CAACK,IAAI,GAAG;YACb7C,IAAI2C,MAAMK,KAAK,CAAC,MAAMJ;QACxB;IACF;AACF;AAEAN,QAAQrC,iBAAiB,GAAGA"}
|
||||
75
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/postcss.js
generated
vendored
Normal file
75
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/postcss.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
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.
|
||||
*/ import path from "path";
|
||||
import { prepend, remove } from "./file-protocol";
|
||||
const ORPHAN_CR_REGEX = /\r(?!\n)(.|\n)?/g;
|
||||
export default function process(postcss, sourceFile, sourceContent, params) {
|
||||
// #107 libsass emits orphan CR not considered newline, postcss does consider newline (content vs source-map mismatch)
|
||||
postcssPlugin.postcss = true;
|
||||
// prepend file protocol to all sources to avoid problems with source map
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return postcss([
|
||||
postcssPlugin
|
||||
]).process(sourceContent, {
|
||||
from: prepend(sourceFile),
|
||||
map: params.outputSourceMap && {
|
||||
prev: !!params.inputSourceMap && prepend(params.inputSourceMap),
|
||||
inline: false,
|
||||
annotation: false,
|
||||
sourcesContent: true
|
||||
}
|
||||
}).then((result)=>({
|
||||
content: result.css,
|
||||
map: params.outputSourceMap ? remove(result.map.toJSON()) : null
|
||||
}));
|
||||
/**
|
||||
* Plugin for postcss that follows SASS transpilation.
|
||||
*/ function postcssPlugin() {
|
||||
return {
|
||||
postcssPlugin: "postcss-resolve-url",
|
||||
Once: function(root) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
root.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 && remove(path.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)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=postcss.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/postcss.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/postcss.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/resolve-url-loader/lib/postcss.ts"],"names":["path","prepend","remove","ORPHAN_CR_REGEX","process","postcss","sourceFile","sourceContent","params","postcssPlugin","from","map","outputSourceMap","prev","inputSourceMap","inline","annotation","sourcesContent","then","result","content","css","toJSON","Once","root","walkDecls","eachDeclaration","declaration","isValid","value","indexOf","startPosApparent","source","start","startPosOriginal","sourceMapConsumer","originalPositionFor","directory","dirname","transformDeclaration","Error","test"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GAEA,OAAOA,UAAU,OAAM;AACvB,SAASC,OAAO,EAAEC,MAAM,QAAQ,kBAAiB;AAEjD,MAAMC,kBAAkB;AAExB,eAAe,SAASC,QACtBC,OAAY,EACZC,UAAe,EACfC,aAAkB,EAClBC,MAAW;IAEX,sHAAsH;IAEtHC,cAAcJ,OAAO,GAAG;IAExB,yEAAyE;IACzE,mEAAmE;IACnE,OAAOA,QAAQ;QAACI;KAAc,EAC3BL,OAAO,CAACG,eAAe;QACtBG,MAAMT,QAAQK;QACdK,KAAKH,OAAOI,eAAe,IAAI;YAC7BC,MAAM,CAAC,CAACL,OAAOM,cAAc,IAAIb,QAAQO,OAAOM,cAAc;YAC9DC,QAAQ;YACRC,YAAY;YACZC,gBAAgB;QAClB;IACF,GACCC,IAAI,CAAC,CAACC,SAAiB,CAAA;YACtBC,SAASD,OAAOE,GAAG;YACnBV,KAAKH,OAAOI,eAAe,GAAGV,OAAOiB,OAAOR,GAAG,CAACW,MAAM,MAAM;QAC9D,CAAA;IAEF;;GAEC,GACD,SAASb;QACP,OAAO;YACLA,eAAe;YACfc,MAAM,SAAUC,IAAS;gBACvB,mEAAmE;gBACnEA,KAAKC,SAAS,CAACC;YACjB;QACF;QAEA;;;KAGC,GACD,SAASA,gBAAgBC,WAAgB;YACvC,MAAMC,UAAUD,YAAYE,KAAK,IAAIF,YAAYE,KAAK,CAACC,OAAO,CAAC,UAAU;YACzE,IAAIF,SAAS;gBACX,wFAAwF;gBACxF,MAAMG,mBAAmBJ,YAAYK,MAAM,CAACC,KAAK,EAC/CC,mBACE1B,OAAO2B,iBAAiB,IACxB3B,OAAO2B,iBAAiB,CAACC,mBAAmB,CAACL;gBAEjD,sDAAsD;gBACtD,MAAMM,YACJH,oBACAA,iBAAiBF,MAAM,IACvB9B,OAAOF,KAAKsC,OAAO,CAACJ,iBAAiBF,MAAM;gBAC7C,IAAIK,WAAW;oBACbV,YAAYE,KAAK,GAAGrB,OAAO+B,oBAAoB,CAC7CZ,YAAYE,KAAK,EACjBQ;gBAEJ,OAEK,IAAI7B,OAAO2B,iBAAiB,EAAE;oBACjC,MAAM,IAAIK,MACR,kEACGrC,CAAAA,gBAAgBsC,IAAI,CAAClC,iBAClB,2CACA,sBAAqB;gBAE/B;YACF;QACF;IACF;AACF"}
|
||||
84
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/value-processor.js
generated
vendored
Normal file
84
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/value-processor.js
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
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.
|
||||
*/ import loaderUtils from "next/dist/compiled/loader-utils2";
|
||||
import path from "path";
|
||||
function valueProcessor(filename, options) {
|
||||
const URL_STATEMENT_REGEX = /(url\s*\()\s*(?:(['"])((?:(?!\2).)*)(\2)|([^'"](?:(?!\)).)*[^'"]))\s*(\))/g;
|
||||
const directory = path.dirname(filename);
|
||||
const join = options.join(filename, options);
|
||||
/**
|
||||
* Process the given CSS declaration value.
|
||||
*
|
||||
*/ return function transformValue(/** A declaration value that may or may not contain a url() statement */ value, /** An absolute path that may be the correct base or an Iterator thereof */ 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 = // eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
testIsRelative(uri) && join(uri, candidate) || // eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
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 loaderUtils.urlToRequest(path.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.
|
||||
*
|
||||
* Returns true for relative uri
|
||||
*/ function testIsRelative(/** A uri string possibly empty or undefined */ uri) {
|
||||
return !!uri && loaderUtils.isUrlRequest(uri, false) && !path.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.
|
||||
*
|
||||
* Returns true for absolute uri
|
||||
*/ function testIsAbsolute(/** A uri string possibly empty or undefined */ uri) {
|
||||
return !!uri && typeof options.root === "string" && loaderUtils.isUrlRequest(uri, options.root) && (/^\//.test(uri) || path.isAbsolute(uri));
|
||||
}
|
||||
}
|
||||
export default valueProcessor;
|
||||
|
||||
//# sourceMappingURL=value-processor.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/value-processor.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/resolve-url-loader/lib/value-processor.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/resolve-url-loader/lib/value-processor.ts"],"names":["loaderUtils","path","valueProcessor","filename","options","URL_STATEMENT_REGEX","directory","dirname","join","transformValue","value","candidate","split","map","token","i","arr","initialised","mod","before","after","isQuoted","unescaped","replace","uri","absolute","testIsRelative","testIsAbsolute","query","keepQuery","slice","urlToRequest","relative","isUrlRequest","isAbsolute","indexOf","root","test"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GAEA,OAAOA,iBAAiB,mCAAkC;AAC1D,OAAOC,UAAU,OAAM;AAEvB,SAASC,eAAeC,QAAa,EAAEC,OAAY;IACjD,MAAMC,sBACJ;IACF,MAAMC,YAAYL,KAAKM,OAAO,CAACJ;IAC/B,MAAMK,OAAOJ,QAAQI,IAAI,CAACL,UAAUC;IAEpC;;;GAGC,GACD,OAAO,SAASK,eACd,sEAAsE,GACtEC,KAAa,EACb,yEAAyE,GACzEC,SAAc;QAEd,iDAAiD;QACjD,mDAAmD;QACnD,sEAAsE;QACtE,yCAAyC;QACzC,OAAOD,MACJE,KAAK,CAACP,qBACNQ,GAAG,CAAC,CAACC,OAAYC,GAAQC;YACxB,mEAAmE;YACnE,MAAMC,cAAcH,SAAS;YAE7B,qEAAqE;YACrE,MAAMI,MAAMH,IAAI;YAChB,IAAIG,QAAQ,KAAKA,QAAQ,GAAG;gBAC1B,6CAA6C;gBAC7C,MAAMC,SAASH,GAAG,CAACD,IAAI,EAAE,EACvBK,QAAQJ,GAAG,CAACD,IAAI,EAAE,EAClBM,WAAWF,WAAWC,SAAUD,CAAAA,WAAW,OAAOA,WAAW,GAAE,GAC/DG,YAAYD,WACRJ,YAAYM,OAAO,CAAC,UAAU,QAC9BN;gBAEN,2EAA2E;gBAC3E,MAAML,QAAQU,UAAUV,KAAK,CAAC,YAC5BY,MAAMZ,KAAK,CAAC,EAAE,EACda,WAEE,AADA,mEAAmE;gBAClEC,eAAeF,QAAQhB,KAAKgB,KAAKb,cAClC,mEAAmE;gBAClEgB,eAAeH,QAAQhB,KAAKgB,MAC/BI,QAAQxB,QAAQyB,SAAS,GAAGjB,MAAMkB,KAAK,CAAC,GAAGtB,IAAI,CAAC,MAAM;gBAExD,2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