nav tabs on admin dashboard
This commit is contained in:
61
node_modules/loader-utils/CHANGELOG.md
generated
vendored
61
node_modules/loader-utils/CHANGELOG.md
generated
vendored
@@ -2,6 +2,61 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="1.2.3"></a>
|
||||
## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **interpolateName:** don't interpolated `hashType` without `hash` or `contenthash` ([#140](https://github.com/webpack/loader-utils/issues/140)) ([3528fd9](https://github.com/webpack/loader-utils/commit/3528fd9))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.2"></a>
|
||||
## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fixed a hash type extracting in interpolateName ([#137](https://github.com/webpack/loader-utils/issues/137)) ([f8a71f4](https://github.com/webpack/loader-utils/commit/f8a71f4))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.1"></a>
|
||||
## [1.2.1](https://github.com/webpack/loader-utils/compare/v1.2.0...v1.2.1) (2018-12-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **isUrlRequest:** better handle absolute urls and non standards ([#134](https://github.com/webpack/loader-utils/issues/134)) ([aca43da](https://github.com/webpack/loader-utils/commit/aca43da))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* PR [#79](https://github.com/webpack/loader-utils/issues/79) ([#135](https://github.com/webpack/loader-utils/issues/135)) ([73d350a](https://github.com/webpack/loader-utils/commit/73d350a))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/webpack/loader-utils/compare/v1.1.0...v1.2.0) (2018-12-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **interpolateName:** support `[contenthash]`
|
||||
|
||||
### Fixes
|
||||
|
||||
* **urlToRequest:** empty urls are not rewritten to relative requests
|
||||
* **urlToRequest:** don't rewrite absolute urls
|
||||
* **isUrlRequest:** ignore all url with `extension` (like `moz-extension:`, `ms-browser-extension:` and etc)
|
||||
* **isUrlRequest:** ignore `about:blank`
|
||||
* **interpolateName:** failing explicitly when ran out of emoji
|
||||
* **interpolateName:** `[hash]` token regex in interpolate string to capture any hash algorithm name
|
||||
* **interpolateName:** parse string for emoji count before use
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/webpack/loader-utils/compare/v1.0.4...v1.1.0) (2017-03-16)
|
||||
|
||||
@@ -10,9 +65,3 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
|
||||
* **automatic-release:** Generation of automatic release ([7484d13](https://github.com/webpack/loader-utils/commit/7484d13))
|
||||
* **parseQuery:** export parseQuery ([ddf64e4](https://github.com/webpack/loader-utils/commit/ddf64e4))
|
||||
|
||||
|
||||
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
32
node_modules/loader-utils/README.md
generated
vendored
32
node_modules/loader-utils/README.md
generated
vendored
@@ -23,8 +23,8 @@ If you pass it on to another library, make sure to make a *deep copy* of it:
|
||||
```javascript
|
||||
const options = Object.assign(
|
||||
{},
|
||||
loaderUtils.getOptions(this), // it is safe to pass null to Object.assign()
|
||||
defaultOptions
|
||||
defaultOptions,
|
||||
loaderUtils.getOptions(this) // it is safe to pass null to Object.assign()
|
||||
);
|
||||
// don't forget nested objects or arrays
|
||||
options.obj = Object.assign({}, options.obj);
|
||||
@@ -32,7 +32,7 @@ options.arr = options.arr.slice();
|
||||
someLibrary(options);
|
||||
```
|
||||
|
||||
[clone-deep](https://www.npmjs.com/package/clone-deep) is a good library to make a deep copy of the options.
|
||||
[clone](https://www.npmjs.com/package/clone) is a good library to make a deep copy of the options.
|
||||
|
||||
#### Options as query strings
|
||||
|
||||
@@ -115,6 +115,21 @@ loaderUtils.stringifyRequest(this, "\\\\network-drive\\test.js");
|
||||
|
||||
Converts some resource URL to a webpack module request.
|
||||
|
||||
> i Before call `urlToRequest` you need call `isUrlRequest` to ensure it is requestable url
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
|
||||
if (loaderUtils.isUrlRequest(url)) {
|
||||
// Logic for requestable url
|
||||
const request = loaderUtils.urlToRequest(url);
|
||||
} else {
|
||||
// Logic for not requestable url
|
||||
}
|
||||
```
|
||||
|
||||
Simple example:
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "./path/to/module.js"
|
||||
@@ -164,6 +179,11 @@ The following tokens are replaced in the `name` parameter:
|
||||
* `[folder]` the folder of the resource is in.
|
||||
* `[emoji]` a random emoji representation of `options.content`
|
||||
* `[emoji:<length>]` same as above, but with a customizable number of emojis
|
||||
* `[contenthash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:contenthash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[hash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:hash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
@@ -171,6 +191,8 @@ The following tokens are replaced in the `name` parameter:
|
||||
* and `length` the length in chars
|
||||
* `[N]` the N-th match obtained from matching the current file name against `options.regExp`
|
||||
|
||||
In loader context `[hash]` and `[contenthash]` are the same, but we recommend using `[contenthash]` for avoid misleading.
|
||||
|
||||
Examples
|
||||
|
||||
``` javascript
|
||||
@@ -178,6 +200,10 @@ Examples
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[contenthash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/app/page.html"
|
||||
loaderUtils.interpolateName(loaderContext, "html-[hash:6].html", { content: ... });
|
||||
// => html-9473fd.html
|
||||
|
||||
19
node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
19
node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
@@ -1,13 +1,16 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
function getCurrentRequest(loaderContext) {
|
||||
if(loaderContext.currentRequest)
|
||||
return loaderContext.currentRequest;
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex)
|
||||
.map(obj => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
return request.join("!");
|
||||
if (loaderContext.currentRequest) {
|
||||
return loaderContext.currentRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getCurrentRequest;
|
||||
|
||||
90
node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
90
node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
@@ -1,53 +1,69 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const baseEncodeTables = {
|
||||
26: "abcdefghijklmnopqrstuvwxyz",
|
||||
32: "123456789abcdefghjkmnpqrstuvwxyz", // no 0lio
|
||||
36: "0123456789abcdefghijklmnopqrstuvwxyz",
|
||||
49: "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no lIO
|
||||
52: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
58: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no 0lIO
|
||||
62: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
64: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"
|
||||
26: 'abcdefghijklmnopqrstuvwxyz',
|
||||
32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
|
||||
36: '0123456789abcdefghijklmnopqrstuvwxyz',
|
||||
49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
|
||||
52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
|
||||
62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
|
||||
};
|
||||
|
||||
function encodeBufferToBase(buffer, base) {
|
||||
const encodeTable = baseEncodeTables[base];
|
||||
if(!encodeTable) throw new Error("Unknown encoding base" + base);
|
||||
const encodeTable = baseEncodeTables[base];
|
||||
if (!encodeTable) {
|
||||
throw new Error('Unknown encoding base' + base);
|
||||
}
|
||||
|
||||
const readLength = buffer.length;
|
||||
const readLength = buffer.length;
|
||||
const Big = require('big.js');
|
||||
|
||||
const Big = require("big.js");
|
||||
Big.RM = Big.DP = 0;
|
||||
let b = new Big(0);
|
||||
for(let i = readLength - 1; i >= 0; i--) {
|
||||
b = b.times(256).plus(buffer[i]);
|
||||
}
|
||||
Big.RM = Big.DP = 0;
|
||||
let b = new Big(0);
|
||||
|
||||
let output = "";
|
||||
while(b.gt(0)) {
|
||||
output = encodeTable[b.mod(base)] + output;
|
||||
b = b.div(base);
|
||||
}
|
||||
for (let i = readLength - 1; i >= 0; i--) {
|
||||
b = b.times(256).plus(buffer[i]);
|
||||
}
|
||||
|
||||
Big.DP = 20;
|
||||
Big.RM = 1;
|
||||
let output = '';
|
||||
while (b.gt(0)) {
|
||||
output = encodeTable[b.mod(base)] + output;
|
||||
b = b.div(base);
|
||||
}
|
||||
|
||||
return output;
|
||||
Big.DP = 20;
|
||||
Big.RM = 1;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function getHashDigest(buffer, hashType, digestType, maxLength) {
|
||||
hashType = hashType || "md5";
|
||||
maxLength = maxLength || 9999;
|
||||
const hash = require("crypto").createHash(hashType);
|
||||
hash.update(buffer);
|
||||
if(digestType === "base26" || digestType === "base32" || digestType === "base36" ||
|
||||
digestType === "base49" || digestType === "base52" || digestType === "base58" ||
|
||||
digestType === "base62" || digestType === "base64") {
|
||||
return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(0, maxLength);
|
||||
} else {
|
||||
return hash.digest(digestType || "hex").substr(0, maxLength);
|
||||
}
|
||||
hashType = hashType || 'md5';
|
||||
maxLength = maxLength || 9999;
|
||||
|
||||
const hash = require('crypto').createHash(hashType);
|
||||
|
||||
hash.update(buffer);
|
||||
|
||||
if (
|
||||
digestType === 'base26' ||
|
||||
digestType === 'base32' ||
|
||||
digestType === 'base36' ||
|
||||
digestType === 'base49' ||
|
||||
digestType === 'base52' ||
|
||||
digestType === 'base58' ||
|
||||
digestType === 'base62' ||
|
||||
digestType === 'base64'
|
||||
) {
|
||||
return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
|
||||
0,
|
||||
maxLength
|
||||
);
|
||||
} else {
|
||||
return hash.digest(digestType || 'hex').substr(0, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = getHashDigest;
|
||||
|
||||
25
node_modules/loader-utils/lib/getOptions.js
generated
vendored
25
node_modules/loader-utils/lib/getOptions.js
generated
vendored
@@ -1,17 +1,20 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const parseQuery = require("./parseQuery");
|
||||
const parseQuery = require('./parseQuery');
|
||||
|
||||
function getOptions(loaderContext) {
|
||||
const query = loaderContext.query;
|
||||
if(typeof query === "string" && query !== "") {
|
||||
return parseQuery(loaderContext.query);
|
||||
}
|
||||
if(!query || typeof query !== "object") {
|
||||
// Not object-like queries are not supported.
|
||||
return null;
|
||||
}
|
||||
return query;
|
||||
const query = loaderContext.query;
|
||||
|
||||
if (typeof query === 'string' && query !== '') {
|
||||
return parseQuery(loaderContext.query);
|
||||
}
|
||||
|
||||
if (!query || typeof query !== 'object') {
|
||||
// Not object-like queries are not supported.
|
||||
return null;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
module.exports = getOptions;
|
||||
|
||||
19
node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
19
node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
@@ -1,13 +1,16 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
function getRemainingRequest(loaderContext) {
|
||||
if(loaderContext.remainingRequest)
|
||||
return loaderContext.remainingRequest;
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex + 1)
|
||||
.map(obj => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
return request.join("!");
|
||||
if (loaderContext.remainingRequest) {
|
||||
return loaderContext.remainingRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex + 1)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getRemainingRequest;
|
||||
|
||||
22
node_modules/loader-utils/lib/index.js
generated
vendored
22
node_modules/loader-utils/lib/index.js
generated
vendored
@@ -1,15 +1,15 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const getOptions = require("./getOptions");
|
||||
const parseQuery = require("./parseQuery");
|
||||
const stringifyRequest = require("./stringifyRequest");
|
||||
const getRemainingRequest = require("./getRemainingRequest");
|
||||
const getCurrentRequest = require("./getCurrentRequest");
|
||||
const isUrlRequest = require("./isUrlRequest");
|
||||
const urlToRequest = require("./urlToRequest");
|
||||
const parseString = require("./parseString");
|
||||
const getHashDigest = require("./getHashDigest");
|
||||
const interpolateName = require("./interpolateName");
|
||||
const getOptions = require('./getOptions');
|
||||
const parseQuery = require('./parseQuery');
|
||||
const stringifyRequest = require('./stringifyRequest');
|
||||
const getRemainingRequest = require('./getRemainingRequest');
|
||||
const getCurrentRequest = require('./getCurrentRequest');
|
||||
const isUrlRequest = require('./isUrlRequest');
|
||||
const urlToRequest = require('./urlToRequest');
|
||||
const parseString = require('./parseString');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
const interpolateName = require('./interpolateName');
|
||||
|
||||
exports.getOptions = getOptions;
|
||||
exports.parseQuery = parseQuery;
|
||||
|
||||
202
node_modules/loader-utils/lib/interpolateName.js
generated
vendored
202
node_modules/loader-utils/lib/interpolateName.js
generated
vendored
@@ -1,95 +1,133 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const path = require("path");
|
||||
const emojisList = require("emojis-list");
|
||||
const getHashDigest = require("./getHashDigest");
|
||||
const path = require('path');
|
||||
const emojisList = require('emojis-list');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
|
||||
const emojiRegex = /[\uD800-\uDFFF]./;
|
||||
const emojiList = emojisList.filter(emoji => emojiRegex.test(emoji));
|
||||
const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
|
||||
const emojiCache = {};
|
||||
|
||||
function encodeStringToEmoji(content, length) {
|
||||
if(emojiCache[content]) return emojiCache[content];
|
||||
length = length || 1;
|
||||
const emojis = [];
|
||||
do {
|
||||
const index = Math.floor(Math.random() * emojiList.length);
|
||||
emojis.push(emojiList[index]);
|
||||
emojiList.splice(index, 1);
|
||||
} while(--length > 0);
|
||||
const emojiEncoding = emojis.join("");
|
||||
emojiCache[content] = emojiEncoding;
|
||||
return emojiEncoding;
|
||||
if (emojiCache[content]) {
|
||||
return emojiCache[content];
|
||||
}
|
||||
|
||||
length = length || 1;
|
||||
|
||||
const emojis = [];
|
||||
|
||||
do {
|
||||
if (!emojiList.length) {
|
||||
throw new Error('Ran out of emoji');
|
||||
}
|
||||
|
||||
const index = Math.floor(Math.random() * emojiList.length);
|
||||
|
||||
emojis.push(emojiList[index]);
|
||||
emojiList.splice(index, 1);
|
||||
} while (--length > 0);
|
||||
|
||||
const emojiEncoding = emojis.join('');
|
||||
|
||||
emojiCache[content] = emojiEncoding;
|
||||
|
||||
return emojiEncoding;
|
||||
}
|
||||
|
||||
function interpolateName(loaderContext, name, options) {
|
||||
let filename;
|
||||
if(typeof name === "function") {
|
||||
filename = name(loaderContext.resourcePath);
|
||||
} else {
|
||||
filename = name || "[hash].[ext]";
|
||||
}
|
||||
const context = options.context;
|
||||
const content = options.content;
|
||||
const regExp = options.regExp;
|
||||
let ext = "bin";
|
||||
let basename = "file";
|
||||
let directory = "";
|
||||
let folder = "";
|
||||
if(loaderContext.resourcePath) {
|
||||
const parsed = path.parse(loaderContext.resourcePath);
|
||||
let resourcePath = loaderContext.resourcePath;
|
||||
let filename;
|
||||
|
||||
if(parsed.ext) {
|
||||
ext = parsed.ext.substr(1);
|
||||
}
|
||||
if(parsed.dir) {
|
||||
basename = parsed.name;
|
||||
resourcePath = parsed.dir + path.sep;
|
||||
}
|
||||
if(typeof context !== "undefined") {
|
||||
directory = path.relative(context, resourcePath + "_").replace(/\\/g, "/").replace(/\.\.(\/)?/g, "_$1");
|
||||
directory = directory.substr(0, directory.length - 1);
|
||||
} else {
|
||||
directory = resourcePath.replace(/\\/g, "/").replace(/\.\.(\/)?/g, "_$1");
|
||||
}
|
||||
if(directory.length === 1) {
|
||||
directory = "";
|
||||
} else if(directory.length > 1) {
|
||||
folder = path.basename(directory);
|
||||
}
|
||||
}
|
||||
let url = filename;
|
||||
if(content) {
|
||||
// Match hash template
|
||||
url = url
|
||||
.replace(
|
||||
/\[(?:(\w+):)?hash(?::([a-z]+\d*))?(?::(\d+))?\]/ig,
|
||||
(all, hashType, digestType, maxLength) => getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
|
||||
)
|
||||
.replace(
|
||||
/\[emoji(?::(\d+))?\]/ig,
|
||||
(all, length) => encodeStringToEmoji(content, length)
|
||||
);
|
||||
}
|
||||
url = url
|
||||
.replace(/\[ext\]/ig, () => ext)
|
||||
.replace(/\[name\]/ig, () => basename)
|
||||
.replace(/\[path\]/ig, () => directory)
|
||||
.replace(/\[folder\]/ig, () => folder);
|
||||
if(regExp && loaderContext.resourcePath) {
|
||||
const match = loaderContext.resourcePath.match(new RegExp(regExp));
|
||||
match && match.forEach((matched, i) => {
|
||||
url = url.replace(
|
||||
new RegExp("\\[" + i + "\\]", "ig"),
|
||||
matched
|
||||
);
|
||||
});
|
||||
}
|
||||
if(typeof loaderContext.options === "object" && typeof loaderContext.options.customInterpolateName === "function") {
|
||||
url = loaderContext.options.customInterpolateName.call(loaderContext, url, name, options);
|
||||
}
|
||||
return url;
|
||||
if (typeof name === 'function') {
|
||||
filename = name(loaderContext.resourcePath);
|
||||
} else {
|
||||
filename = name || '[hash].[ext]';
|
||||
}
|
||||
|
||||
const context = options.context;
|
||||
const content = options.content;
|
||||
const regExp = options.regExp;
|
||||
|
||||
let ext = 'bin';
|
||||
let basename = 'file';
|
||||
let directory = '';
|
||||
let folder = '';
|
||||
|
||||
if (loaderContext.resourcePath) {
|
||||
const parsed = path.parse(loaderContext.resourcePath);
|
||||
let resourcePath = loaderContext.resourcePath;
|
||||
|
||||
if (parsed.ext) {
|
||||
ext = parsed.ext.substr(1);
|
||||
}
|
||||
|
||||
if (parsed.dir) {
|
||||
basename = parsed.name;
|
||||
resourcePath = parsed.dir + path.sep;
|
||||
}
|
||||
|
||||
if (typeof context !== 'undefined') {
|
||||
directory = path
|
||||
.relative(context, resourcePath + '_')
|
||||
.replace(/\\/g, '/')
|
||||
.replace(/\.\.(\/)?/g, '_$1');
|
||||
directory = directory.substr(0, directory.length - 1);
|
||||
} else {
|
||||
directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
|
||||
}
|
||||
|
||||
if (directory.length === 1) {
|
||||
directory = '';
|
||||
} else if (directory.length > 1) {
|
||||
folder = path.basename(directory);
|
||||
}
|
||||
}
|
||||
|
||||
let url = filename;
|
||||
|
||||
if (content) {
|
||||
// Match hash template
|
||||
url = url
|
||||
// `hash` and `contenthash` are same in `loader-utils` context
|
||||
// let's keep `hash` for backward compatibility
|
||||
.replace(
|
||||
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
|
||||
(all, hashType, digestType, maxLength) =>
|
||||
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
|
||||
)
|
||||
.replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
|
||||
encodeStringToEmoji(content, parseInt(length, 10))
|
||||
);
|
||||
}
|
||||
|
||||
url = url
|
||||
.replace(/\[ext\]/gi, () => ext)
|
||||
.replace(/\[name\]/gi, () => basename)
|
||||
.replace(/\[path\]/gi, () => directory)
|
||||
.replace(/\[folder\]/gi, () => folder);
|
||||
|
||||
if (regExp && loaderContext.resourcePath) {
|
||||
const match = loaderContext.resourcePath.match(new RegExp(regExp));
|
||||
|
||||
match &&
|
||||
match.forEach((matched, i) => {
|
||||
url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
typeof loaderContext.options === 'object' &&
|
||||
typeof loaderContext.options.customInterpolateName === 'function'
|
||||
) {
|
||||
url = loaderContext.options.customInterpolateName.call(
|
||||
loaderContext,
|
||||
url,
|
||||
name,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
module.exports = interpolateName;
|
||||
|
||||
35
node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
35
node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
@@ -1,14 +1,31 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
function isUrlRequest(url, root) {
|
||||
// An URL is not an request if
|
||||
// 1. it's a Data Url
|
||||
// 2. it's an absolute url or and protocol-relative
|
||||
// 3. it's some kind of url for a template
|
||||
if(/^data:|^chrome-extension:|^(https?:)?\/\/|^[\{\}\[\]#*;,'§\$%&\(=?`´\^°<>]/.test(url)) return false;
|
||||
// 4. It's also not an request if root isn't set and it's a root-relative url
|
||||
if((root === undefined || root === false) && /^\//.test(url)) return false;
|
||||
return true;
|
||||
// An URL is not an request if
|
||||
|
||||
// 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path.win32.isAbsolute(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. It's a protocol-relative
|
||||
if (/^\/\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. It's some kind of url for a template
|
||||
if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4. It's also not an request if root isn't set and it's a root-relative url
|
||||
if ((root === undefined || root === false) && /^\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isUrlRequest;
|
||||
|
||||
104
node_modules/loader-utils/lib/parseQuery.js
generated
vendored
104
node_modules/loader-utils/lib/parseQuery.js
generated
vendored
@@ -1,54 +1,68 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const JSON5 = require("json5");
|
||||
const JSON5 = require('json5');
|
||||
|
||||
const specialValues = {
|
||||
"null": null,
|
||||
"true": true,
|
||||
"false": false
|
||||
null: null,
|
||||
true: true,
|
||||
false: false,
|
||||
};
|
||||
|
||||
function parseQuery(query) {
|
||||
if(query.substr(0, 1) !== "?") {
|
||||
throw new Error("A valid query string passed to parseQuery should begin with '?'");
|
||||
}
|
||||
query = query.substr(1);
|
||||
if(!query) {
|
||||
return {};
|
||||
}
|
||||
if(query.substr(0, 1) === "{" && query.substr(-1) === "}") {
|
||||
return JSON5.parse(query);
|
||||
}
|
||||
const queryArgs = query.split(/[,&]/g);
|
||||
const result = {};
|
||||
queryArgs.forEach(arg => {
|
||||
const idx = arg.indexOf("=");
|
||||
if(idx >= 0) {
|
||||
let name = arg.substr(0, idx);
|
||||
let value = decodeURIComponent(arg.substr(idx + 1));
|
||||
if(specialValues.hasOwnProperty(value)) {
|
||||
value = specialValues[value];
|
||||
}
|
||||
if(name.substr(-2) === "[]") {
|
||||
name = decodeURIComponent(name.substr(0, name.length - 2));
|
||||
if(!Array.isArray(result[name]))
|
||||
result[name] = [];
|
||||
result[name].push(value);
|
||||
} else {
|
||||
name = decodeURIComponent(name);
|
||||
result[name] = value;
|
||||
}
|
||||
} else {
|
||||
if(arg.substr(0, 1) === "-") {
|
||||
result[decodeURIComponent(arg.substr(1))] = false;
|
||||
} else if(arg.substr(0, 1) === "+") {
|
||||
result[decodeURIComponent(arg.substr(1))] = true;
|
||||
} else {
|
||||
result[decodeURIComponent(arg)] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
if (query.substr(0, 1) !== '?') {
|
||||
throw new Error(
|
||||
"A valid query string passed to parseQuery should begin with '?'"
|
||||
);
|
||||
}
|
||||
|
||||
query = query.substr(1);
|
||||
|
||||
if (!query) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
|
||||
return JSON5.parse(query);
|
||||
}
|
||||
|
||||
const queryArgs = query.split(/[,&]/g);
|
||||
const result = {};
|
||||
|
||||
queryArgs.forEach((arg) => {
|
||||
const idx = arg.indexOf('=');
|
||||
|
||||
if (idx >= 0) {
|
||||
let name = arg.substr(0, idx);
|
||||
let value = decodeURIComponent(arg.substr(idx + 1));
|
||||
|
||||
if (specialValues.hasOwnProperty(value)) {
|
||||
value = specialValues[value];
|
||||
}
|
||||
|
||||
if (name.substr(-2) === '[]') {
|
||||
name = decodeURIComponent(name.substr(0, name.length - 2));
|
||||
|
||||
if (!Array.isArray(result[name])) {
|
||||
result[name] = [];
|
||||
}
|
||||
|
||||
result[name].push(value);
|
||||
} else {
|
||||
name = decodeURIComponent(name);
|
||||
result[name] = value;
|
||||
}
|
||||
} else {
|
||||
if (arg.substr(0, 1) === '-') {
|
||||
result[decodeURIComponent(arg.substr(1))] = false;
|
||||
} else if (arg.substr(0, 1) === '+') {
|
||||
result[decodeURIComponent(arg.substr(1))] = true;
|
||||
} else {
|
||||
result[decodeURIComponent(arg)] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = parseQuery;
|
||||
|
||||
32
node_modules/loader-utils/lib/parseString.js
generated
vendored
32
node_modules/loader-utils/lib/parseString.js
generated
vendored
@@ -1,19 +1,23 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
function parseString(str) {
|
||||
try {
|
||||
if(str[0] === "\"") return JSON.parse(str);
|
||||
if(str[0] === "'" && str.substr(str.length - 1) === "'") {
|
||||
return parseString(
|
||||
str
|
||||
.replace(/\\.|"/g, x => x === "\"" ? "\\\"" : x)
|
||||
.replace(/^'|'$/g, "\"")
|
||||
);
|
||||
}
|
||||
return JSON.parse("\"" + str + "\"");
|
||||
} catch(e) {
|
||||
return str;
|
||||
}
|
||||
try {
|
||||
if (str[0] === '"') {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
if (str[0] === "'" && str.substr(str.length - 1) === "'") {
|
||||
return parseString(
|
||||
str
|
||||
.replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
|
||||
.replace(/^'|'$/g, '"')
|
||||
);
|
||||
}
|
||||
|
||||
return JSON.parse('"' + str + '"');
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parseString;
|
||||
|
||||
63
node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
63
node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
@@ -1,40 +1,51 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const path = require("path");
|
||||
const path = require('path');
|
||||
|
||||
const matchRelativePath = /^\.\.?[/\\]/;
|
||||
|
||||
function isAbsolutePath(str) {
|
||||
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
|
||||
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
|
||||
}
|
||||
|
||||
function isRelativePath(str) {
|
||||
return matchRelativePath.test(str);
|
||||
return matchRelativePath.test(str);
|
||||
}
|
||||
|
||||
function stringifyRequest(loaderContext, request) {
|
||||
const splitted = request.split("!");
|
||||
const context = loaderContext.context || (loaderContext.options && loaderContext.options.context);
|
||||
return JSON.stringify(splitted.map(part => {
|
||||
// First, separate singlePath from query, because the query might contain paths again
|
||||
const splittedPart = part.match(/^(.*?)(\?.*)/);
|
||||
let singlePath = splittedPart ? splittedPart[1] : part;
|
||||
const query = splittedPart ? splittedPart[2] : "";
|
||||
if(isAbsolutePath(singlePath) && context) {
|
||||
singlePath = path.relative(context, singlePath);
|
||||
if(isAbsolutePath(singlePath)) {
|
||||
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
|
||||
// In this case, we leave the path platform-specific without replacing any separators.
|
||||
// @see https://github.com/webpack/loader-utils/pull/14
|
||||
return singlePath + query;
|
||||
}
|
||||
if(isRelativePath(singlePath) === false) {
|
||||
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
|
||||
singlePath = "./" + singlePath;
|
||||
}
|
||||
}
|
||||
return singlePath.replace(/\\/g, "/") + query;
|
||||
}).join("!"));
|
||||
const splitted = request.split('!');
|
||||
const context =
|
||||
loaderContext.context ||
|
||||
(loaderContext.options && loaderContext.options.context);
|
||||
|
||||
return JSON.stringify(
|
||||
splitted
|
||||
.map((part) => {
|
||||
// First, separate singlePath from query, because the query might contain paths again
|
||||
const splittedPart = part.match(/^(.*?)(\?.*)/);
|
||||
const query = splittedPart ? splittedPart[2] : '';
|
||||
let singlePath = splittedPart ? splittedPart[1] : part;
|
||||
|
||||
if (isAbsolutePath(singlePath) && context) {
|
||||
singlePath = path.relative(context, singlePath);
|
||||
|
||||
if (isAbsolutePath(singlePath)) {
|
||||
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
|
||||
// In this case, we leave the path platform-specific without replacing any separators.
|
||||
// @see https://github.com/webpack/loader-utils/pull/14
|
||||
return singlePath + query;
|
||||
}
|
||||
|
||||
if (isRelativePath(singlePath) === false) {
|
||||
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
|
||||
singlePath = './' + singlePath;
|
||||
}
|
||||
}
|
||||
|
||||
return singlePath.replace(/\\/g, '/') + query;
|
||||
})
|
||||
.join('!')
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = stringifyRequest;
|
||||
|
||||
87
node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
87
node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
@@ -1,49 +1,60 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
// we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
|
||||
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
|
||||
function urlToRequest(url, root) {
|
||||
const moduleRequestRegex = /^[^?]*~/;
|
||||
let request;
|
||||
// Do not rewrite an empty url
|
||||
if (url === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if(matchNativeWin32Path.test(url)) {
|
||||
// absolute windows path, keep it
|
||||
request = url;
|
||||
} else if(root !== undefined && root !== false && /^\//.test(url)) {
|
||||
// if root is set and the url is root-relative
|
||||
switch(typeof root) {
|
||||
// 1. root is a string: root is prefixed to the url
|
||||
case "string":
|
||||
// special case: `~` roots convert to module request
|
||||
if(moduleRequestRegex.test(root)) {
|
||||
request = root.replace(/([^~\/])$/, "$1/") + url.slice(1);
|
||||
} else {
|
||||
request = root + url;
|
||||
}
|
||||
break;
|
||||
// 2. root is `true`: absolute paths are allowed
|
||||
// *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
|
||||
case "boolean":
|
||||
request = url;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unexpected parameters to loader-utils 'urlToRequest': url = " + url + ", root = " + root + ".");
|
||||
}
|
||||
} else if(/^\.\.?\//.test(url)) {
|
||||
// A relative url stays
|
||||
request = url;
|
||||
} else {
|
||||
// every other url is threaded like a relative url
|
||||
request = "./" + url;
|
||||
}
|
||||
const moduleRequestRegex = /^[^?]*~/;
|
||||
let request;
|
||||
|
||||
// A `~` makes the url an module
|
||||
if(moduleRequestRegex.test(request)) {
|
||||
request = request.replace(moduleRequestRegex, "");
|
||||
}
|
||||
if (matchNativeWin32Path.test(url)) {
|
||||
// absolute windows path, keep it
|
||||
request = url;
|
||||
} else if (root !== undefined && root !== false && /^\//.test(url)) {
|
||||
// if root is set and the url is root-relative
|
||||
switch (typeof root) {
|
||||
// 1. root is a string: root is prefixed to the url
|
||||
case 'string':
|
||||
// special case: `~` roots convert to module request
|
||||
if (moduleRequestRegex.test(root)) {
|
||||
request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
|
||||
} else {
|
||||
request = root + url;
|
||||
}
|
||||
break;
|
||||
// 2. root is `true`: absolute paths are allowed
|
||||
// *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
|
||||
case 'boolean':
|
||||
request = url;
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
"Unexpected parameters to loader-utils 'urlToRequest': url = " +
|
||||
url +
|
||||
', root = ' +
|
||||
root +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
} else if (/^\.\.?\//.test(url)) {
|
||||
// A relative url stays
|
||||
request = url;
|
||||
} else {
|
||||
// every other url is threaded like a relative url
|
||||
request = './' + url;
|
||||
}
|
||||
|
||||
return request;
|
||||
// A `~` makes the url an module
|
||||
if (moduleRequestRegex.test(request)) {
|
||||
request = request.replace(moduleRequestRegex, '');
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
module.exports = urlToRequest;
|
||||
|
||||
44
node_modules/loader-utils/package.json
generated
vendored
44
node_modules/loader-utils/package.json
generated
vendored
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"_from": "loader-utils@^1.0.2",
|
||||
"_id": "loader-utils@1.1.0",
|
||||
"_id": "loader-utils@1.2.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=",
|
||||
"_integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
|
||||
"_location": "/loader-utils",
|
||||
"_phantomChildren": {},
|
||||
"_phantomChildren": {
|
||||
"minimist": "1.2.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
@@ -16,7 +18,6 @@
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/adjust-sourcemap-loader",
|
||||
"/babel-loader",
|
||||
"/css-loader",
|
||||
"/extract-text-webpack-plugin",
|
||||
@@ -24,15 +25,14 @@
|
||||
"/html-loader",
|
||||
"/img-loader",
|
||||
"/postcss-loader",
|
||||
"/resolve-url-loader",
|
||||
"/sass-loader",
|
||||
"/style-loader",
|
||||
"/vue-loader",
|
||||
"/vue-style-loader",
|
||||
"/webpack"
|
||||
"/webpack",
|
||||
"/webpack-cli"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz",
|
||||
"_shasum": "c98aef488bcceda2ffb5e2de646d6a754429f5cd",
|
||||
"_resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
|
||||
"_shasum": "1ff5dc6911c9f0a062531a4c04b609406108c2c7",
|
||||
"_spec": "loader-utils@^1.0.2",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\babel-loader",
|
||||
"author": {
|
||||
@@ -43,18 +43,19 @@
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"big.js": "^3.1.3",
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^2.0.0",
|
||||
"json5": "^0.5.0"
|
||||
"json5": "^1.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "utils for webpack loaders",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"eslint": "^3.15.0",
|
||||
"eslint-plugin-node": "^4.0.1",
|
||||
"istanbul": "^0.3.14",
|
||||
"mocha": "^1.21.4",
|
||||
"coveralls": "^3.0.2",
|
||||
"eslint": "^5.11.0",
|
||||
"eslint-plugin-node": "^8.0.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"jest": "^21.2.1",
|
||||
"prettier": "^1.15.3",
|
||||
"standard-version": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -72,12 +73,11 @@
|
||||
"url": "git+https://github.com/webpack/loader-utils.git"
|
||||
},
|
||||
"scripts": {
|
||||
"cover": "istanbul cover -x *.runtime.js node_modules/mocha/bin/_mocha",
|
||||
"lint": "eslint lib test",
|
||||
"posttest": "npm run lint",
|
||||
"release": "npm test && standard-version",
|
||||
"test": "mocha",
|
||||
"travis": "npm run cover -- --report lcovonly"
|
||||
"pretest": "yarn lint",
|
||||
"release": "yarn test && standard-version",
|
||||
"test": "jest",
|
||||
"test:ci": "jest --coverage"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
"version": "1.2.3"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user