Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

Location:
trip-planner-front/node_modules/svgo/lib
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/svgo/lib/svgo-node.js

    r59329aa re29cc2e  
    1616const importConfig = async (configFile) => {
    1717  let config;
    18   try {
    19     // dynamic import expects file url instead of path and may fail
    20     // when windows path is provided
    21     const { default: imported } = await import(pathToFileURL(configFile));
    22     config = imported;
    23   } catch (importError) {
    24     // TODO remove require in v3
     18  // at the moment dynamic import may randomly fail with segfault
     19  // to workaround this for some users .cjs extension is loaded
     20  // exclusively with require
     21  if (configFile.endsWith('.cjs')) {
     22    config = require(configFile);
     23  } else {
    2524    try {
    26       config = require(configFile);
    27     } catch (requireError) {
    28       // throw original error if es module is detected
    29       if (requireError.code === 'ERR_REQUIRE_ESM') {
    30         throw importError;
    31       } else {
    32         throw requireError;
     25      // dynamic import expects file url instead of path and may fail
     26      // when windows path is provided
     27      const { default: imported } = await import(pathToFileURL(configFile));
     28      config = imported;
     29    } catch (importError) {
     30      // TODO remove require in v3
     31      try {
     32        config = require(configFile);
     33      } catch (requireError) {
     34        // throw original error if es module is detected
     35        if (requireError.code === 'ERR_REQUIRE_ESM') {
     36          throw importError;
     37        } else {
     38          throw requireError;
     39        }
    3340      }
    3441    }
  • trip-planner-front/node_modules/svgo/lib/svgo.js

    r59329aa re29cc2e  
    77} = require('./svgo/config.js');
    88const { parseSvg } = require('./parser.js');
    9 const js2svg = require('./svgo/js2svg.js');
     9const { stringifySvg } = require('./stringifier.js');
    1010const { invokePlugins } = require('./svgo/plugins.js');
    1111const JSAPI = require('./svgo/jsAPI.js');
     
    5454    }
    5555    svgjs = invokePlugins(svgjs, info, resolvedPlugins, null, globalOverrides);
    56     svgjs = js2svg(svgjs, config.js2svg);
    57     if (svgjs.error) {
    58       throw Error(svgjs.error);
    59     }
     56    svgjs = stringifySvg(svgjs, config.js2svg);
    6057    if (svgjs.data.length < prevResultSize) {
    6158      input = svgjs.data;
  • trip-planner-front/node_modules/svgo/lib/svgo/coa.js

    r59329aa re29cc2e  
    11'use strict';
    22
    3 const FS = require('fs');
    4 const PATH = require('path');
    5 const { green, red } = require('nanocolors');
     3const fs = require('fs');
     4const path = require('path');
     5const colors = require('picocolors');
    66const { loadConfig, optimize } = require('../svgo-node.js');
    77const pluginsMap = require('../../plugins/plugins.js');
     
    1717function checkIsDir(path) {
    1818  try {
    19     return FS.lstatSync(path).isDirectory();
     19    return fs.lstatSync(path).isDirectory();
    2020  } catch (e) {
    2121    return false;
     
    7474    )
    7575    .option('--show-plugins', 'Show available plugins and exit')
     76    // used by picocolors internally
     77    .option('--no-color', 'Output plain text without color')
    7678    .action(action);
    7779};
     
    219221          output[i] = checkIsDir(input[i])
    220222            ? input[i]
    221             : PATH.resolve(dir, PATH.basename(input[i]));
     223            : path.resolve(dir, path.basename(input[i]));
    222224        }
    223225      } else if (output.length < input.length) {
     
    284286    console.log(`Processing directory '${dir}':\n`);
    285287  }
    286   return FS.promises
     288  return fs.promises
    287289    .readdir(dir)
    288290    .then((files) => processDirectory(config, dir, files, output));
     
    332334    )
    333335    .map((name) => ({
    334       inputPath: PATH.resolve(dir, name),
    335       outputPath: PATH.resolve(output, name),
     336      inputPath: path.resolve(dir, name),
     337      outputPath: path.resolve(output, name),
    336338    }));
    337339
     
    340342        filesInThisFolder,
    341343        files
    342           .filter((name) => checkIsDir(PATH.resolve(dir, name)))
     344          .filter((name) => checkIsDir(path.resolve(dir, name)))
    343345          .map((subFolderName) => {
    344             const subFolderPath = PATH.resolve(dir, subFolderName);
    345             const subFolderFiles = FS.readdirSync(subFolderPath);
    346             const subFolderOutput = PATH.resolve(output, subFolderName);
     346            const subFolderPath = path.resolve(dir, subFolderName);
     347            const subFolderFiles = fs.readdirSync(subFolderPath);
     348            const subFolderOutput = path.resolve(output, subFolderName);
    347349            return getFilesDescriptions(
    348350              config,
     
    365367 */
    366368function optimizeFile(config, file, output) {
    367   return FS.promises.readFile(file, 'utf8').then(
     369  return fs.promises.readFile(file, 'utf8').then(
    368370    (data) =>
    369371      processSVGData(config, { input: 'file', path: file }, data, output, file),
     
    386388  const result = optimize(data, { ...config, ...info });
    387389  if (result.modernError) {
    388     console.error(red(result.modernError.toString()));
     390    console.error(colors.red(result.modernError.toString()));
    389391    process.exit(1);
    390392  }
     
    399401      if (!config.quiet && output != '-') {
    400402        if (input) {
    401           console.log(`\n${PATH.basename(input)}:`);
     403          console.log(`\n${path.basename(input)}:`);
    402404        }
    403405        printTimeInfo(processingTime);
     
    429431  }
    430432
    431   FS.mkdirSync(PATH.dirname(output), { recursive: true });
    432 
    433   return FS.promises
     433  fs.mkdirSync(path.dirname(output), { recursive: true });
     434
     435  return fs.promises
    434436    .writeFile(output, data, 'utf8')
    435437    .catch((error) => checkWriteFileError(input, output, data, error));
     
    456458      ' KiB' +
    457459      (profitPercents < 0 ? ' + ' : ' - ') +
    458       green(Math.abs(Math.round(profitPercents * 10) / 10) + '%') +
     460      colors.green(Math.abs(Math.round(profitPercents * 10) / 10) + '%') +
    459461      ' = ' +
    460462      Math.round((outBytes / 1024) * 1000) / 1000 +
     
    492494function checkWriteFileError(input, output, data, error) {
    493495  if (error.code == 'EISDIR' && input) {
    494     return FS.promises.writeFile(
    495       PATH.resolve(output, PATH.basename(input)),
     496    return fs.promises.writeFile(
     497      path.resolve(output, path.basename(input)),
    496498      data,
    497499      'utf8'
     
    508510  const list = Object.entries(pluginsMap)
    509511    .sort(([a], [b]) => a.localeCompare(b))
    510     .map(([name, plugin]) => ` [ ${green(name)} ] ${plugin.description}`)
     512    .map(([name, plugin]) => ` [ ${colors.green(name)} ] ${plugin.description}`)
    511513    .join('\n');
    512514  console.log('Currently available plugins:\n' + list);
  • trip-planner-front/node_modules/svgo/lib/svgo/plugins.js

    r59329aa re29cc2e  
    8787        globalOverrides.floatPrecision = floatPrecision;
    8888      }
     89      if (overrides) {
     90        for (const [pluginName, override] of Object.entries(overrides)) {
     91          if (override === true) {
     92            console.warn(
     93              `You are trying to enable ${pluginName} which is not part of preset.\n` +
     94                `Try to put it before or after preset, for example\n\n` +
     95                `plugins: [\n` +
     96                `  {\n` +
     97                `    name: 'preset-default',\n` +
     98                `  },\n` +
     99                `  'cleanupListOfValues'\n` +
     100                `]\n`
     101            );
     102          }
     103        }
     104      }
    89105      return invokePlugins(ast, info, plugins, overrides, globalOverrides);
    90106    },
  • trip-planner-front/node_modules/svgo/lib/types.ts

    r59329aa re29cc2e  
    5151
    5252export type XastNode = XastRoot | XastChild;
     53
     54export type StringifyOptions = {
     55  doctypeStart?: string;
     56  doctypeEnd?: string;
     57  procInstStart?: string;
     58  procInstEnd?: string;
     59  tagOpenStart?: string;
     60  tagOpenEnd?: string;
     61  tagCloseStart?: string;
     62  tagCloseEnd?: string;
     63  tagShortStart?: string;
     64  tagShortEnd?: string;
     65  attrStart?: string;
     66  attrEnd?: string;
     67  commentStart?: string;
     68  commentEnd?: string;
     69  cdataStart?: string;
     70  cdataEnd?: string;
     71  textStart?: string;
     72  textEnd?: string;
     73  indent?: number | string;
     74  regEntities?: RegExp;
     75  regValEntities?: RegExp;
     76  encodeEntity?: (char: string) => string;
     77  pretty?: boolean;
     78  useShortTags?: boolean;
     79  eol?: 'lf' | 'crlf';
     80  finalNewline?: boolean;
     81};
    5382
    5483type VisitorNode<Node> = {
Note: See TracChangeset for help on using the changeset viewer.