@parcel/utils 2.0.0-canary.1814 → 2.0.0-canary.1819
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +52 -1
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/src/index.js +2 -1
- package/src/svgo.js +108 -0
package/lib/index.js
CHANGED
|
@@ -3466,6 +3466,7 @@ $parcel$export(module.exports, "normalizeSeparators", () => $2cfc43e5a1610e21$ex
|
|
|
3466
3466
|
$parcel$export(module.exports, "relativePath", () => $2cfc43e5a1610e21$export$7413eea5ad243d4);
|
|
3467
3467
|
$parcel$export(module.exports, "replaceURLReferences", () => $cbd5168e62104afe$export$d0d0105f44defc19);
|
|
3468
3468
|
$parcel$export(module.exports, "replaceInlineReferences", () => $cbd5168e62104afe$export$f074a8f9bef628fd);
|
|
3469
|
+
$parcel$export(module.exports, "getURLReplacement", () => $cbd5168e62104afe$export$a22ef0cbdf8abc95);
|
|
3469
3470
|
$parcel$export(module.exports, "measureStreamLength", () => $43ad97e2cc03a562$export$457f03b1bf37ec1a);
|
|
3470
3471
|
$parcel$export(module.exports, "readableFromStringOrBuffer", () => $43ad97e2cc03a562$export$dc30d0b81ccad9c7);
|
|
3471
3472
|
$parcel$export(module.exports, "bufferStream", () => $43ad97e2cc03a562$export$f109d1c79a5ae5a1);
|
|
@@ -3483,6 +3484,7 @@ $parcel$export(module.exports, "loadSourceMap", () => $3d4b4a41954c6194$export$c
|
|
|
3483
3484
|
$parcel$export(module.exports, "remapSourceLocation", () => $3d4b4a41954c6194$export$2fed780245c466c1);
|
|
3484
3485
|
$parcel$export(module.exports, "stripAnsi", () => (/*@__PURE__*/$parcel$interopDefault($c6e7686f671d96bd$exports)));
|
|
3485
3486
|
$parcel$export(module.exports, "detectSVGOVersion", () => $898ec9690c913f83$export$d9e46360b4510851);
|
|
3487
|
+
$parcel$export(module.exports, "convertSVGOConfig", () => $898ec9690c913f83$export$cd81e436d777a245);
|
|
3486
3488
|
$parcel$export(module.exports, "getImportMap", () => $26334e67aed21124$export$3e5fb54e0985f82a);
|
|
3487
3489
|
function $2dffa662028edb3d$export$2e2bcd8739ae039(string, startIndex = 0) {
|
|
3488
3490
|
let lines = 1;
|
|
@@ -35123,7 +35125,7 @@ var $83d29ad750833698$var$clone = function() {
|
|
|
35123
35125
|
clone.__getRegExpFlags = __getRegExpFlags;
|
|
35124
35126
|
return clone;
|
|
35125
35127
|
}();
|
|
35126
|
-
if (
|
|
35128
|
+
if ($83d29ad750833698$exports) $83d29ad750833698$exports = $83d29ad750833698$var$clone;
|
|
35127
35129
|
|
|
35128
35130
|
|
|
35129
35131
|
// This is a generated file. Do not edit.
|
|
@@ -38213,6 +38215,8 @@ $7865b56d1a966ce7$exports = ({ onlyFirst: onlyFirst = false } = {})=>{
|
|
|
38213
38215
|
$c6e7686f671d96bd$exports = (string)=>typeof string === 'string' ? string.replace($7865b56d1a966ce7$exports(), '') : string;
|
|
38214
38216
|
|
|
38215
38217
|
|
|
38218
|
+
|
|
38219
|
+
|
|
38216
38220
|
function $898ec9690c913f83$export$d9e46360b4510851(config) {
|
|
38217
38221
|
if (!config) return {
|
|
38218
38222
|
version: 3
|
|
@@ -38251,6 +38255,53 @@ function $898ec9690c913f83$export$d9e46360b4510851(config) {
|
|
|
38251
38255
|
version: 3
|
|
38252
38256
|
};
|
|
38253
38257
|
}
|
|
38258
|
+
async function $898ec9690c913f83$export$cd81e436d777a245(config, filePath, jsonPath, fs, hint) {
|
|
38259
|
+
if (typeof config === 'boolean') return {
|
|
38260
|
+
default: config
|
|
38261
|
+
};
|
|
38262
|
+
if (!config || typeof config !== 'object') return {
|
|
38263
|
+
default: true
|
|
38264
|
+
};
|
|
38265
|
+
let result = {
|
|
38266
|
+
default: false
|
|
38267
|
+
};
|
|
38268
|
+
if (Array.isArray(config.plugins)) for (let [i, plugin] of config.plugins.entries()){
|
|
38269
|
+
let name, params = true;
|
|
38270
|
+
if (typeof plugin === 'string') name = plugin;
|
|
38271
|
+
else if (typeof plugin === 'object' && typeof plugin?.name === 'string') {
|
|
38272
|
+
name = plugin.name;
|
|
38273
|
+
params = plugin.params ?? true;
|
|
38274
|
+
if (typeof plugin.fn === 'function') await $898ec9690c913f83$var$throwDiagnostic('Unsupported custom SVGO plugin.', filePath, `${jsonPath}/plugins/${i}/fn`, fs, hint);
|
|
38275
|
+
} else if (typeof plugin === 'function') await $898ec9690c913f83$var$throwDiagnostic('Unsupported custom SVGO plugin.', filePath, `${jsonPath}/plugins/${i}`, fs, hint);
|
|
38276
|
+
else continue;
|
|
38277
|
+
if (name === 'cleanupIDs') name = 'cleanupIds';
|
|
38278
|
+
if (name === 'preset-default') {
|
|
38279
|
+
result.default = true;
|
|
38280
|
+
if (typeof params === 'object' && typeof params?.overrides === 'object' && params.overrides) for(let key in params.overrides)result[key] = params.overrides[key];
|
|
38281
|
+
} else if (typeof name === 'string') result[name] = params || false;
|
|
38282
|
+
}
|
|
38283
|
+
return result;
|
|
38284
|
+
}
|
|
38285
|
+
async function $898ec9690c913f83$var$throwDiagnostic(message, filePath, jsonPath, fs, hint) {
|
|
38286
|
+
throw new (0, ($parcel$interopDefault($houHs$parceldiagnostic)))({
|
|
38287
|
+
diagnostic: {
|
|
38288
|
+
message: message,
|
|
38289
|
+
codeFrames: [
|
|
38290
|
+
{
|
|
38291
|
+
filePath: filePath,
|
|
38292
|
+
codeHighlights: (0, ($parcel$interopDefault($houHs$path))).extname(filePath) === '' || (0, ($parcel$interopDefault($houHs$path))).extname(filePath) === '.json' ? (0, $houHs$parceldiagnostic.generateJSONCodeHighlights)(await fs.readFile(filePath, 'utf8'), [
|
|
38293
|
+
{
|
|
38294
|
+
key: jsonPath
|
|
38295
|
+
}
|
|
38296
|
+
]) : []
|
|
38297
|
+
}
|
|
38298
|
+
],
|
|
38299
|
+
hints: hint ? [
|
|
38300
|
+
hint
|
|
38301
|
+
] : []
|
|
38302
|
+
}
|
|
38303
|
+
});
|
|
38304
|
+
}
|
|
38254
38305
|
|
|
38255
38306
|
|
|
38256
38307
|
|