.
This commit is contained in:
		
							
								
								
									
										21
									
								
								qwen/nodejs/node_modules/jest-snapshot/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								qwen/nodejs/node_modules/jest-snapshot/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
							
								
								
									
										421
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/InlineSnapshots.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										421
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/InlineSnapshots.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,421 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.saveInlineSnapshots = saveInlineSnapshots;
 | 
			
		||||
var path = _interopRequireWildcard(require('path'));
 | 
			
		||||
var _util = require('util');
 | 
			
		||||
var fs = _interopRequireWildcard(require('graceful-fs'));
 | 
			
		||||
var _semver = _interopRequireDefault(require('semver'));
 | 
			
		||||
var _utils = require('./utils');
 | 
			
		||||
function _interopRequireDefault(obj) {
 | 
			
		||||
  return obj && obj.__esModule ? obj : {default: obj};
 | 
			
		||||
}
 | 
			
		||||
function _getRequireWildcardCache(nodeInterop) {
 | 
			
		||||
  if (typeof WeakMap !== 'function') return null;
 | 
			
		||||
  var cacheBabelInterop = new WeakMap();
 | 
			
		||||
  var cacheNodeInterop = new WeakMap();
 | 
			
		||||
  return (_getRequireWildcardCache = function (nodeInterop) {
 | 
			
		||||
    return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
 | 
			
		||||
  })(nodeInterop);
 | 
			
		||||
}
 | 
			
		||||
function _interopRequireWildcard(obj, nodeInterop) {
 | 
			
		||||
  if (!nodeInterop && obj && obj.__esModule) {
 | 
			
		||||
    return obj;
 | 
			
		||||
  }
 | 
			
		||||
  if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
 | 
			
		||||
    return {default: obj};
 | 
			
		||||
  }
 | 
			
		||||
  var cache = _getRequireWildcardCache(nodeInterop);
 | 
			
		||||
  if (cache && cache.has(obj)) {
 | 
			
		||||
    return cache.get(obj);
 | 
			
		||||
  }
 | 
			
		||||
  var newObj = {};
 | 
			
		||||
  var hasPropertyDescriptor =
 | 
			
		||||
    Object.defineProperty && Object.getOwnPropertyDescriptor;
 | 
			
		||||
  for (var key in obj) {
 | 
			
		||||
    if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
 | 
			
		||||
      var desc = hasPropertyDescriptor
 | 
			
		||||
        ? Object.getOwnPropertyDescriptor(obj, key)
 | 
			
		||||
        : null;
 | 
			
		||||
      if (desc && (desc.get || desc.set)) {
 | 
			
		||||
        Object.defineProperty(newObj, key, desc);
 | 
			
		||||
      } else {
 | 
			
		||||
        newObj[key] = obj[key];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  newObj.default = obj;
 | 
			
		||||
  if (cache) {
 | 
			
		||||
    cache.set(obj, newObj);
 | 
			
		||||
  }
 | 
			
		||||
  return newObj;
 | 
			
		||||
}
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestWriteFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-write-file')] || fs.writeFileSync;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestReadFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-read-file')] || fs.readFileSync;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
// prettier-ignore
 | 
			
		||||
const generate = // @ts-expect-error requireOutside Babel transform
 | 
			
		||||
require(require.resolve('@babel/generator', {
 | 
			
		||||
  [(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for('jest-resolve-outside-vm-option')]: true
 | 
			
		||||
})).default;
 | 
			
		||||
const {
 | 
			
		||||
  isAwaitExpression,
 | 
			
		||||
  templateElement,
 | 
			
		||||
  templateLiteral,
 | 
			
		||||
  traverse,
 | 
			
		||||
  traverseFast
 | 
			
		||||
} = require(require.resolve('@babel/types', { // @ts-expect-error requireOutside Babel transform
 | 
			
		||||
  [(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for(
 | 
			
		||||
    'jest-resolve-outside-vm-option'
 | 
			
		||||
  )]: true
 | 
			
		||||
}));
 | 
			
		||||
// @ts-expect-error requireOutside Babel transform
 | 
			
		||||
const {parseSync} = require(require.resolve('@babel/core', {
 | 
			
		||||
  [(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for(
 | 
			
		||||
    'jest-resolve-outside-vm-option'
 | 
			
		||||
  )]: true
 | 
			
		||||
}));
 | 
			
		||||
function saveInlineSnapshots(snapshots, rootDir, prettierPath) {
 | 
			
		||||
  let prettier = null;
 | 
			
		||||
  if (prettierPath) {
 | 
			
		||||
    try {
 | 
			
		||||
      // @ts-expect-error requireOutside Babel transform
 | 
			
		||||
      prettier = require(require.resolve(prettierPath, {
 | 
			
		||||
        [(globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol).for(
 | 
			
		||||
          'jest-resolve-outside-vm-option'
 | 
			
		||||
        )]: true
 | 
			
		||||
      }));
 | 
			
		||||
      if (_semver.default.gte(prettier.version, '3.0.0')) {
 | 
			
		||||
        throw new Error(
 | 
			
		||||
          'Jest: Inline Snapshots are not supported when using Prettier 3.0.0 or above.\nSee https://jestjs.io/docs/configuration/#prettierpath-string for alternatives.'
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      if (!_util.types.isNativeError(error)) {
 | 
			
		||||
        throw error;
 | 
			
		||||
      }
 | 
			
		||||
      if (error.code !== 'MODULE_NOT_FOUND') {
 | 
			
		||||
        throw error;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  const snapshotsByFile = groupSnapshotsByFile(snapshots);
 | 
			
		||||
  for (const sourceFilePath of Object.keys(snapshotsByFile)) {
 | 
			
		||||
    saveSnapshotsForFile(
 | 
			
		||||
      snapshotsByFile[sourceFilePath],
 | 
			
		||||
      sourceFilePath,
 | 
			
		||||
      rootDir,
 | 
			
		||||
      prettier && _semver.default.gte(prettier.version, '1.5.0')
 | 
			
		||||
        ? prettier
 | 
			
		||||
        : undefined
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
const saveSnapshotsForFile = (snapshots, sourceFilePath, rootDir, prettier) => {
 | 
			
		||||
  const sourceFile = jestReadFile(sourceFilePath, 'utf8');
 | 
			
		||||
 | 
			
		||||
  // TypeScript projects may not have a babel config; make sure they can be parsed anyway.
 | 
			
		||||
  const presets = [require.resolve('babel-preset-current-node-syntax')];
 | 
			
		||||
  const plugins = [];
 | 
			
		||||
  if (/\.([cm]?ts|tsx)$/.test(sourceFilePath)) {
 | 
			
		||||
    plugins.push([
 | 
			
		||||
      require.resolve('@babel/plugin-syntax-typescript'),
 | 
			
		||||
      {
 | 
			
		||||
        isTSX: sourceFilePath.endsWith('x')
 | 
			
		||||
      },
 | 
			
		||||
      // unique name to make sure Babel does not complain about a possible duplicate plugin.
 | 
			
		||||
      'TypeScript syntax plugin added by Jest snapshot'
 | 
			
		||||
    ]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Record the matcher names seen during traversal and pass them down one
 | 
			
		||||
  // by one to formatting parser.
 | 
			
		||||
  const snapshotMatcherNames = [];
 | 
			
		||||
  let ast = null;
 | 
			
		||||
  try {
 | 
			
		||||
    ast = parseSync(sourceFile, {
 | 
			
		||||
      filename: sourceFilePath,
 | 
			
		||||
      plugins,
 | 
			
		||||
      presets,
 | 
			
		||||
      root: rootDir
 | 
			
		||||
    });
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    // attempt to recover from missing jsx plugin
 | 
			
		||||
    if (error.message.includes('@babel/plugin-syntax-jsx')) {
 | 
			
		||||
      try {
 | 
			
		||||
        const jsxSyntaxPlugin = [
 | 
			
		||||
          require.resolve('@babel/plugin-syntax-jsx'),
 | 
			
		||||
          {},
 | 
			
		||||
          // unique name to make sure Babel does not complain about a possible duplicate plugin.
 | 
			
		||||
          'JSX syntax plugin added by Jest snapshot'
 | 
			
		||||
        ];
 | 
			
		||||
        ast = parseSync(sourceFile, {
 | 
			
		||||
          filename: sourceFilePath,
 | 
			
		||||
          plugins: [...plugins, jsxSyntaxPlugin],
 | 
			
		||||
          presets,
 | 
			
		||||
          root: rootDir
 | 
			
		||||
        });
 | 
			
		||||
      } catch {
 | 
			
		||||
        throw error;
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      throw error;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (!ast) {
 | 
			
		||||
    throw new Error(`jest-snapshot: Failed to parse ${sourceFilePath}`);
 | 
			
		||||
  }
 | 
			
		||||
  traverseAst(snapshots, ast, snapshotMatcherNames);
 | 
			
		||||
 | 
			
		||||
  // substitute in the snapshots in reverse order, so slice calculations aren't thrown off.
 | 
			
		||||
  const sourceFileWithSnapshots = snapshots.reduceRight(
 | 
			
		||||
    (sourceSoFar, nextSnapshot) => {
 | 
			
		||||
      const {node} = nextSnapshot;
 | 
			
		||||
      if (
 | 
			
		||||
        !node ||
 | 
			
		||||
        typeof node.start !== 'number' ||
 | 
			
		||||
        typeof node.end !== 'number'
 | 
			
		||||
      ) {
 | 
			
		||||
        throw new Error('Jest: no snapshot insert location found');
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // A hack to prevent unexpected line breaks in the generated code
 | 
			
		||||
      node.loc.end.line = node.loc.start.line;
 | 
			
		||||
      return (
 | 
			
		||||
        sourceSoFar.slice(0, node.start) +
 | 
			
		||||
        generate(node, {
 | 
			
		||||
          retainLines: true
 | 
			
		||||
        }).code.trim() +
 | 
			
		||||
        sourceSoFar.slice(node.end)
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
    sourceFile
 | 
			
		||||
  );
 | 
			
		||||
  const newSourceFile = prettier
 | 
			
		||||
    ? runPrettier(
 | 
			
		||||
        prettier,
 | 
			
		||||
        sourceFilePath,
 | 
			
		||||
        sourceFileWithSnapshots,
 | 
			
		||||
        snapshotMatcherNames
 | 
			
		||||
      )
 | 
			
		||||
    : sourceFileWithSnapshots;
 | 
			
		||||
  if (newSourceFile !== sourceFile) {
 | 
			
		||||
    jestWriteFile(sourceFilePath, newSourceFile);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
const groupSnapshotsBy = createKey => snapshots =>
 | 
			
		||||
  snapshots.reduce((object, inlineSnapshot) => {
 | 
			
		||||
    const key = createKey(inlineSnapshot);
 | 
			
		||||
    return {
 | 
			
		||||
      ...object,
 | 
			
		||||
      [key]: (object[key] || []).concat(inlineSnapshot)
 | 
			
		||||
    };
 | 
			
		||||
  }, {});
 | 
			
		||||
const groupSnapshotsByFrame = groupSnapshotsBy(({frame: {line, column}}) =>
 | 
			
		||||
  typeof line === 'number' && typeof column === 'number'
 | 
			
		||||
    ? `${line}:${column - 1}`
 | 
			
		||||
    : ''
 | 
			
		||||
);
 | 
			
		||||
const groupSnapshotsByFile = groupSnapshotsBy(({frame: {file}}) => file);
 | 
			
		||||
const indent = (snapshot, numIndents, indentation) => {
 | 
			
		||||
  const lines = snapshot.split('\n');
 | 
			
		||||
  // Prevent re-indentation of inline snapshots.
 | 
			
		||||
  if (
 | 
			
		||||
    lines.length >= 2 &&
 | 
			
		||||
    lines[1].startsWith(indentation.repeat(numIndents + 1))
 | 
			
		||||
  ) {
 | 
			
		||||
    return snapshot;
 | 
			
		||||
  }
 | 
			
		||||
  return lines
 | 
			
		||||
    .map((line, index) => {
 | 
			
		||||
      if (index === 0) {
 | 
			
		||||
        // First line is either a 1-line snapshot or a blank line.
 | 
			
		||||
        return line;
 | 
			
		||||
      } else if (index !== lines.length - 1) {
 | 
			
		||||
        // Do not indent empty lines.
 | 
			
		||||
        if (line === '') {
 | 
			
		||||
          return line;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Not last line, indent one level deeper than expect call.
 | 
			
		||||
        return indentation.repeat(numIndents + 1) + line;
 | 
			
		||||
      } else {
 | 
			
		||||
        // The last line should be placed on the same level as the expect call.
 | 
			
		||||
        return indentation.repeat(numIndents) + line;
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
    .join('\n');
 | 
			
		||||
};
 | 
			
		||||
const traverseAst = (snapshots, ast, snapshotMatcherNames) => {
 | 
			
		||||
  const groupedSnapshots = groupSnapshotsByFrame(snapshots);
 | 
			
		||||
  const remainingSnapshots = new Set(snapshots.map(({snapshot}) => snapshot));
 | 
			
		||||
  traverseFast(ast, node => {
 | 
			
		||||
    if (node.type !== 'CallExpression') return;
 | 
			
		||||
    const {arguments: args, callee} = node;
 | 
			
		||||
    if (
 | 
			
		||||
      callee.type !== 'MemberExpression' ||
 | 
			
		||||
      callee.property.type !== 'Identifier' ||
 | 
			
		||||
      callee.property.loc == null
 | 
			
		||||
    ) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    const {line, column} = callee.property.loc.start;
 | 
			
		||||
    const snapshotsForFrame = groupedSnapshots[`${line}:${column}`];
 | 
			
		||||
    if (!snapshotsForFrame) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    if (snapshotsForFrame.length > 1) {
 | 
			
		||||
      throw new Error(
 | 
			
		||||
        'Jest: Multiple inline snapshots for the same call are not supported.'
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    const inlineSnapshot = snapshotsForFrame[0];
 | 
			
		||||
    inlineSnapshot.node = node;
 | 
			
		||||
    snapshotMatcherNames.push(callee.property.name);
 | 
			
		||||
    const snapshotIndex = args.findIndex(
 | 
			
		||||
      ({type}) => type === 'TemplateLiteral' || type === 'StringLiteral'
 | 
			
		||||
    );
 | 
			
		||||
    const {snapshot} = inlineSnapshot;
 | 
			
		||||
    remainingSnapshots.delete(snapshot);
 | 
			
		||||
    const replacementNode = templateLiteral(
 | 
			
		||||
      [
 | 
			
		||||
        templateElement({
 | 
			
		||||
          raw: (0, _utils.escapeBacktickString)(snapshot)
 | 
			
		||||
        })
 | 
			
		||||
      ],
 | 
			
		||||
      []
 | 
			
		||||
    );
 | 
			
		||||
    if (snapshotIndex > -1) {
 | 
			
		||||
      args[snapshotIndex] = replacementNode;
 | 
			
		||||
    } else {
 | 
			
		||||
      args.push(replacementNode);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  if (remainingSnapshots.size) {
 | 
			
		||||
    throw new Error("Jest: Couldn't locate all inline snapshots.");
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
const runPrettier = (
 | 
			
		||||
  prettier,
 | 
			
		||||
  sourceFilePath,
 | 
			
		||||
  sourceFileWithSnapshots,
 | 
			
		||||
  snapshotMatcherNames
 | 
			
		||||
) => {
 | 
			
		||||
  // Resolve project configuration.
 | 
			
		||||
  // For older versions of Prettier, do not load configuration.
 | 
			
		||||
  const config = prettier.resolveConfig
 | 
			
		||||
    ? prettier.resolveConfig.sync(sourceFilePath, {
 | 
			
		||||
        editorconfig: true
 | 
			
		||||
      })
 | 
			
		||||
    : null;
 | 
			
		||||
 | 
			
		||||
  // Prioritize parser found in the project config.
 | 
			
		||||
  // If not found detect the parser for the test file.
 | 
			
		||||
  // For older versions of Prettier, fallback to a simple parser detection.
 | 
			
		||||
  // @ts-expect-error - `inferredParser` is `string`
 | 
			
		||||
  const inferredParser =
 | 
			
		||||
    (config && typeof config.parser === 'string' && config.parser) ||
 | 
			
		||||
    (prettier.getFileInfo
 | 
			
		||||
      ? prettier.getFileInfo.sync(sourceFilePath).inferredParser
 | 
			
		||||
      : simpleDetectParser(sourceFilePath));
 | 
			
		||||
  if (!inferredParser) {
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      `Could not infer Prettier parser for file ${sourceFilePath}`
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Snapshots have now been inserted. Run prettier to make sure that the code is
 | 
			
		||||
  // formatted, except snapshot indentation. Snapshots cannot be formatted until
 | 
			
		||||
  // after the initial format because we don't know where the call expression
 | 
			
		||||
  // will be placed (specifically its indentation), so we have to do two
 | 
			
		||||
  // prettier.format calls back-to-back.
 | 
			
		||||
  return prettier.format(
 | 
			
		||||
    prettier.format(sourceFileWithSnapshots, {
 | 
			
		||||
      ...config,
 | 
			
		||||
      filepath: sourceFilePath
 | 
			
		||||
    }),
 | 
			
		||||
    {
 | 
			
		||||
      ...config,
 | 
			
		||||
      filepath: sourceFilePath,
 | 
			
		||||
      parser: createFormattingParser(snapshotMatcherNames, inferredParser)
 | 
			
		||||
    }
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// This parser formats snapshots to the correct indentation.
 | 
			
		||||
const createFormattingParser =
 | 
			
		||||
  (snapshotMatcherNames, inferredParser) => (text, parsers, options) => {
 | 
			
		||||
    // Workaround for https://github.com/prettier/prettier/issues/3150
 | 
			
		||||
    options.parser = inferredParser;
 | 
			
		||||
    const ast = parsers[inferredParser](text, options);
 | 
			
		||||
    traverse(ast, (node, ancestors) => {
 | 
			
		||||
      if (node.type !== 'CallExpression') return;
 | 
			
		||||
      const {arguments: args, callee} = node;
 | 
			
		||||
      if (
 | 
			
		||||
        callee.type !== 'MemberExpression' ||
 | 
			
		||||
        callee.property.type !== 'Identifier' ||
 | 
			
		||||
        !snapshotMatcherNames.includes(callee.property.name) ||
 | 
			
		||||
        !callee.loc ||
 | 
			
		||||
        callee.computed
 | 
			
		||||
      ) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      let snapshotIndex;
 | 
			
		||||
      let snapshot;
 | 
			
		||||
      for (let i = 0; i < args.length; i++) {
 | 
			
		||||
        const node = args[i];
 | 
			
		||||
        if (node.type === 'TemplateLiteral') {
 | 
			
		||||
          snapshotIndex = i;
 | 
			
		||||
          snapshot = node.quasis[0].value.raw;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (snapshot === undefined) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      const parent = ancestors[ancestors.length - 1].node;
 | 
			
		||||
      const startColumn =
 | 
			
		||||
        isAwaitExpression(parent) && parent.loc
 | 
			
		||||
          ? parent.loc.start.column
 | 
			
		||||
          : callee.loc.start.column;
 | 
			
		||||
      const useSpaces = !options.useTabs;
 | 
			
		||||
      snapshot = indent(
 | 
			
		||||
        snapshot,
 | 
			
		||||
        Math.ceil(
 | 
			
		||||
          useSpaces
 | 
			
		||||
            ? startColumn / (options.tabWidth ?? 1)
 | 
			
		||||
            : // Each tab is 2 characters.
 | 
			
		||||
              startColumn / 2
 | 
			
		||||
        ),
 | 
			
		||||
        useSpaces ? ' '.repeat(options.tabWidth ?? 1) : '\t'
 | 
			
		||||
      );
 | 
			
		||||
      const replacementNode = templateLiteral(
 | 
			
		||||
        [
 | 
			
		||||
          templateElement({
 | 
			
		||||
            raw: snapshot
 | 
			
		||||
          })
 | 
			
		||||
        ],
 | 
			
		||||
        []
 | 
			
		||||
      );
 | 
			
		||||
      args[snapshotIndex] = replacementNode;
 | 
			
		||||
    });
 | 
			
		||||
    return ast;
 | 
			
		||||
  };
 | 
			
		||||
const simpleDetectParser = filePath => {
 | 
			
		||||
  const extname = path.extname(filePath);
 | 
			
		||||
  if (/\.tsx?$/.test(extname)) {
 | 
			
		||||
    return 'typescript';
 | 
			
		||||
  }
 | 
			
		||||
  return 'babel';
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										153
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/SnapshotResolver.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										153
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/SnapshotResolver.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,153 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.isSnapshotPath =
 | 
			
		||||
  exports.buildSnapshotResolver =
 | 
			
		||||
  exports.EXTENSION =
 | 
			
		||||
  exports.DOT_EXTENSION =
 | 
			
		||||
    void 0;
 | 
			
		||||
var path = _interopRequireWildcard(require('path'));
 | 
			
		||||
var _chalk = _interopRequireDefault(require('chalk'));
 | 
			
		||||
var _transform = require('@jest/transform');
 | 
			
		||||
var _jestUtil = require('jest-util');
 | 
			
		||||
function _interopRequireDefault(obj) {
 | 
			
		||||
  return obj && obj.__esModule ? obj : {default: obj};
 | 
			
		||||
}
 | 
			
		||||
function _getRequireWildcardCache(nodeInterop) {
 | 
			
		||||
  if (typeof WeakMap !== 'function') return null;
 | 
			
		||||
  var cacheBabelInterop = new WeakMap();
 | 
			
		||||
  var cacheNodeInterop = new WeakMap();
 | 
			
		||||
  return (_getRequireWildcardCache = function (nodeInterop) {
 | 
			
		||||
    return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
 | 
			
		||||
  })(nodeInterop);
 | 
			
		||||
}
 | 
			
		||||
function _interopRequireWildcard(obj, nodeInterop) {
 | 
			
		||||
  if (!nodeInterop && obj && obj.__esModule) {
 | 
			
		||||
    return obj;
 | 
			
		||||
  }
 | 
			
		||||
  if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
 | 
			
		||||
    return {default: obj};
 | 
			
		||||
  }
 | 
			
		||||
  var cache = _getRequireWildcardCache(nodeInterop);
 | 
			
		||||
  if (cache && cache.has(obj)) {
 | 
			
		||||
    return cache.get(obj);
 | 
			
		||||
  }
 | 
			
		||||
  var newObj = {};
 | 
			
		||||
  var hasPropertyDescriptor =
 | 
			
		||||
    Object.defineProperty && Object.getOwnPropertyDescriptor;
 | 
			
		||||
  for (var key in obj) {
 | 
			
		||||
    if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
 | 
			
		||||
      var desc = hasPropertyDescriptor
 | 
			
		||||
        ? Object.getOwnPropertyDescriptor(obj, key)
 | 
			
		||||
        : null;
 | 
			
		||||
      if (desc && (desc.get || desc.set)) {
 | 
			
		||||
        Object.defineProperty(newObj, key, desc);
 | 
			
		||||
      } else {
 | 
			
		||||
        newObj[key] = obj[key];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  newObj.default = obj;
 | 
			
		||||
  if (cache) {
 | 
			
		||||
    cache.set(obj, newObj);
 | 
			
		||||
  }
 | 
			
		||||
  return newObj;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const EXTENSION = 'snap';
 | 
			
		||||
exports.EXTENSION = EXTENSION;
 | 
			
		||||
const DOT_EXTENSION = `.${EXTENSION}`;
 | 
			
		||||
exports.DOT_EXTENSION = DOT_EXTENSION;
 | 
			
		||||
const isSnapshotPath = path => path.endsWith(DOT_EXTENSION);
 | 
			
		||||
exports.isSnapshotPath = isSnapshotPath;
 | 
			
		||||
const cache = new Map();
 | 
			
		||||
const buildSnapshotResolver = async (
 | 
			
		||||
  config,
 | 
			
		||||
  localRequire = (0, _transform.createTranspilingRequire)(config)
 | 
			
		||||
) => {
 | 
			
		||||
  const key = config.rootDir;
 | 
			
		||||
  const resolver =
 | 
			
		||||
    cache.get(key) ??
 | 
			
		||||
    (await createSnapshotResolver(await localRequire, config.snapshotResolver));
 | 
			
		||||
  cache.set(key, resolver);
 | 
			
		||||
  return resolver;
 | 
			
		||||
};
 | 
			
		||||
exports.buildSnapshotResolver = buildSnapshotResolver;
 | 
			
		||||
async function createSnapshotResolver(localRequire, snapshotResolverPath) {
 | 
			
		||||
  return typeof snapshotResolverPath === 'string'
 | 
			
		||||
    ? createCustomSnapshotResolver(snapshotResolverPath, localRequire)
 | 
			
		||||
    : createDefaultSnapshotResolver();
 | 
			
		||||
}
 | 
			
		||||
function createDefaultSnapshotResolver() {
 | 
			
		||||
  return {
 | 
			
		||||
    resolveSnapshotPath: testPath =>
 | 
			
		||||
      path.join(
 | 
			
		||||
        path.join(path.dirname(testPath), '__snapshots__'),
 | 
			
		||||
        path.basename(testPath) + DOT_EXTENSION
 | 
			
		||||
      ),
 | 
			
		||||
    resolveTestPath: snapshotPath =>
 | 
			
		||||
      path.resolve(
 | 
			
		||||
        path.dirname(snapshotPath),
 | 
			
		||||
        '..',
 | 
			
		||||
        path.basename(snapshotPath, DOT_EXTENSION)
 | 
			
		||||
      ),
 | 
			
		||||
    testPathForConsistencyCheck: path.posix.join(
 | 
			
		||||
      'consistency_check',
 | 
			
		||||
      '__tests__',
 | 
			
		||||
      'example.test.js'
 | 
			
		||||
    )
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
async function createCustomSnapshotResolver(
 | 
			
		||||
  snapshotResolverPath,
 | 
			
		||||
  localRequire
 | 
			
		||||
) {
 | 
			
		||||
  const custom = (0, _jestUtil.interopRequireDefault)(
 | 
			
		||||
    await localRequire(snapshotResolverPath)
 | 
			
		||||
  ).default;
 | 
			
		||||
  const keys = [
 | 
			
		||||
    ['resolveSnapshotPath', 'function'],
 | 
			
		||||
    ['resolveTestPath', 'function'],
 | 
			
		||||
    ['testPathForConsistencyCheck', 'string']
 | 
			
		||||
  ];
 | 
			
		||||
  keys.forEach(([propName, requiredType]) => {
 | 
			
		||||
    if (typeof custom[propName] !== requiredType) {
 | 
			
		||||
      throw new TypeError(mustImplement(propName, requiredType));
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  const customResolver = {
 | 
			
		||||
    resolveSnapshotPath: testPath =>
 | 
			
		||||
      custom.resolveSnapshotPath(testPath, DOT_EXTENSION),
 | 
			
		||||
    resolveTestPath: snapshotPath =>
 | 
			
		||||
      custom.resolveTestPath(snapshotPath, DOT_EXTENSION),
 | 
			
		||||
    testPathForConsistencyCheck: custom.testPathForConsistencyCheck
 | 
			
		||||
  };
 | 
			
		||||
  verifyConsistentTransformations(customResolver);
 | 
			
		||||
  return customResolver;
 | 
			
		||||
}
 | 
			
		||||
function mustImplement(propName, requiredType) {
 | 
			
		||||
  return `${_chalk.default.bold(
 | 
			
		||||
    `Custom snapshot resolver must implement a \`${propName}\` as a ${requiredType}.`
 | 
			
		||||
  )}\nDocumentation: https://jestjs.io/docs/configuration#snapshotresolver-string`;
 | 
			
		||||
}
 | 
			
		||||
function verifyConsistentTransformations(custom) {
 | 
			
		||||
  const resolvedSnapshotPath = custom.resolveSnapshotPath(
 | 
			
		||||
    custom.testPathForConsistencyCheck
 | 
			
		||||
  );
 | 
			
		||||
  const resolvedTestPath = custom.resolveTestPath(resolvedSnapshotPath);
 | 
			
		||||
  if (resolvedTestPath !== custom.testPathForConsistencyCheck) {
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      _chalk.default.bold(
 | 
			
		||||
        `Custom snapshot resolver functions must transform paths consistently, i.e. expects resolveTestPath(resolveSnapshotPath('${custom.testPathForConsistencyCheck}')) === ${resolvedTestPath}`
 | 
			
		||||
      )
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										288
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/State.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										288
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/State.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,288 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.default = void 0;
 | 
			
		||||
var fs = _interopRequireWildcard(require('graceful-fs'));
 | 
			
		||||
var _jestMessageUtil = require('jest-message-util');
 | 
			
		||||
var _InlineSnapshots = require('./InlineSnapshots');
 | 
			
		||||
var _utils = require('./utils');
 | 
			
		||||
function _getRequireWildcardCache(nodeInterop) {
 | 
			
		||||
  if (typeof WeakMap !== 'function') return null;
 | 
			
		||||
  var cacheBabelInterop = new WeakMap();
 | 
			
		||||
  var cacheNodeInterop = new WeakMap();
 | 
			
		||||
  return (_getRequireWildcardCache = function (nodeInterop) {
 | 
			
		||||
    return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
 | 
			
		||||
  })(nodeInterop);
 | 
			
		||||
}
 | 
			
		||||
function _interopRequireWildcard(obj, nodeInterop) {
 | 
			
		||||
  if (!nodeInterop && obj && obj.__esModule) {
 | 
			
		||||
    return obj;
 | 
			
		||||
  }
 | 
			
		||||
  if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
 | 
			
		||||
    return {default: obj};
 | 
			
		||||
  }
 | 
			
		||||
  var cache = _getRequireWildcardCache(nodeInterop);
 | 
			
		||||
  if (cache && cache.has(obj)) {
 | 
			
		||||
    return cache.get(obj);
 | 
			
		||||
  }
 | 
			
		||||
  var newObj = {};
 | 
			
		||||
  var hasPropertyDescriptor =
 | 
			
		||||
    Object.defineProperty && Object.getOwnPropertyDescriptor;
 | 
			
		||||
  for (var key in obj) {
 | 
			
		||||
    if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
 | 
			
		||||
      var desc = hasPropertyDescriptor
 | 
			
		||||
        ? Object.getOwnPropertyDescriptor(obj, key)
 | 
			
		||||
        : null;
 | 
			
		||||
      if (desc && (desc.get || desc.set)) {
 | 
			
		||||
        Object.defineProperty(newObj, key, desc);
 | 
			
		||||
      } else {
 | 
			
		||||
        newObj[key] = obj[key];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  newObj.default = obj;
 | 
			
		||||
  if (cache) {
 | 
			
		||||
    cache.set(obj, newObj);
 | 
			
		||||
  }
 | 
			
		||||
  return newObj;
 | 
			
		||||
}
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestExistsFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-exists-file')] || fs.existsSync;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
class SnapshotState {
 | 
			
		||||
  _counters;
 | 
			
		||||
  _dirty;
 | 
			
		||||
  // @ts-expect-error - seemingly unused?
 | 
			
		||||
  _index;
 | 
			
		||||
  _updateSnapshot;
 | 
			
		||||
  _snapshotData;
 | 
			
		||||
  _initialData;
 | 
			
		||||
  _snapshotPath;
 | 
			
		||||
  _inlineSnapshots;
 | 
			
		||||
  _uncheckedKeys;
 | 
			
		||||
  _prettierPath;
 | 
			
		||||
  _rootDir;
 | 
			
		||||
  snapshotFormat;
 | 
			
		||||
  added;
 | 
			
		||||
  expand;
 | 
			
		||||
  matched;
 | 
			
		||||
  unmatched;
 | 
			
		||||
  updated;
 | 
			
		||||
  constructor(snapshotPath, options) {
 | 
			
		||||
    this._snapshotPath = snapshotPath;
 | 
			
		||||
    const {data, dirty} = (0, _utils.getSnapshotData)(
 | 
			
		||||
      this._snapshotPath,
 | 
			
		||||
      options.updateSnapshot
 | 
			
		||||
    );
 | 
			
		||||
    this._initialData = data;
 | 
			
		||||
    this._snapshotData = data;
 | 
			
		||||
    this._dirty = dirty;
 | 
			
		||||
    this._prettierPath = options.prettierPath ?? null;
 | 
			
		||||
    this._inlineSnapshots = [];
 | 
			
		||||
    this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
 | 
			
		||||
    this._counters = new Map();
 | 
			
		||||
    this._index = 0;
 | 
			
		||||
    this.expand = options.expand || false;
 | 
			
		||||
    this.added = 0;
 | 
			
		||||
    this.matched = 0;
 | 
			
		||||
    this.unmatched = 0;
 | 
			
		||||
    this._updateSnapshot = options.updateSnapshot;
 | 
			
		||||
    this.updated = 0;
 | 
			
		||||
    this.snapshotFormat = options.snapshotFormat;
 | 
			
		||||
    this._rootDir = options.rootDir;
 | 
			
		||||
  }
 | 
			
		||||
  markSnapshotsAsCheckedForTest(testName) {
 | 
			
		||||
    this._uncheckedKeys.forEach(uncheckedKey => {
 | 
			
		||||
      if ((0, _utils.keyToTestName)(uncheckedKey) === testName) {
 | 
			
		||||
        this._uncheckedKeys.delete(uncheckedKey);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  _addSnapshot(key, receivedSerialized, options) {
 | 
			
		||||
    this._dirty = true;
 | 
			
		||||
    if (options.isInline) {
 | 
			
		||||
      const error = options.error || new Error();
 | 
			
		||||
      const lines = (0, _jestMessageUtil.getStackTraceLines)(
 | 
			
		||||
        (0, _utils.removeLinesBeforeExternalMatcherTrap)(error.stack || '')
 | 
			
		||||
      );
 | 
			
		||||
      const frame = (0, _jestMessageUtil.getTopFrame)(lines);
 | 
			
		||||
      if (!frame) {
 | 
			
		||||
        throw new Error(
 | 
			
		||||
          "Jest: Couldn't infer stack frame for inline snapshot."
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
      this._inlineSnapshots.push({
 | 
			
		||||
        frame,
 | 
			
		||||
        snapshot: receivedSerialized
 | 
			
		||||
      });
 | 
			
		||||
    } else {
 | 
			
		||||
      this._snapshotData[key] = receivedSerialized;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  clear() {
 | 
			
		||||
    this._snapshotData = this._initialData;
 | 
			
		||||
    this._inlineSnapshots = [];
 | 
			
		||||
    this._counters = new Map();
 | 
			
		||||
    this._index = 0;
 | 
			
		||||
    this.added = 0;
 | 
			
		||||
    this.matched = 0;
 | 
			
		||||
    this.unmatched = 0;
 | 
			
		||||
    this.updated = 0;
 | 
			
		||||
  }
 | 
			
		||||
  save() {
 | 
			
		||||
    const hasExternalSnapshots = Object.keys(this._snapshotData).length;
 | 
			
		||||
    const hasInlineSnapshots = this._inlineSnapshots.length;
 | 
			
		||||
    const isEmpty = !hasExternalSnapshots && !hasInlineSnapshots;
 | 
			
		||||
    const status = {
 | 
			
		||||
      deleted: false,
 | 
			
		||||
      saved: false
 | 
			
		||||
    };
 | 
			
		||||
    if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
 | 
			
		||||
      if (hasExternalSnapshots) {
 | 
			
		||||
        (0, _utils.saveSnapshotFile)(this._snapshotData, this._snapshotPath);
 | 
			
		||||
      }
 | 
			
		||||
      if (hasInlineSnapshots) {
 | 
			
		||||
        (0, _InlineSnapshots.saveInlineSnapshots)(
 | 
			
		||||
          this._inlineSnapshots,
 | 
			
		||||
          this._rootDir,
 | 
			
		||||
          this._prettierPath
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
      status.saved = true;
 | 
			
		||||
    } else if (!hasExternalSnapshots && jestExistsFile(this._snapshotPath)) {
 | 
			
		||||
      if (this._updateSnapshot === 'all') {
 | 
			
		||||
        fs.unlinkSync(this._snapshotPath);
 | 
			
		||||
      }
 | 
			
		||||
      status.deleted = true;
 | 
			
		||||
    }
 | 
			
		||||
    return status;
 | 
			
		||||
  }
 | 
			
		||||
  getUncheckedCount() {
 | 
			
		||||
    return this._uncheckedKeys.size || 0;
 | 
			
		||||
  }
 | 
			
		||||
  getUncheckedKeys() {
 | 
			
		||||
    return Array.from(this._uncheckedKeys);
 | 
			
		||||
  }
 | 
			
		||||
  removeUncheckedKeys() {
 | 
			
		||||
    if (this._updateSnapshot === 'all' && this._uncheckedKeys.size) {
 | 
			
		||||
      this._dirty = true;
 | 
			
		||||
      this._uncheckedKeys.forEach(key => delete this._snapshotData[key]);
 | 
			
		||||
      this._uncheckedKeys.clear();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  match({testName, received, key, inlineSnapshot, isInline, error}) {
 | 
			
		||||
    this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
 | 
			
		||||
    const count = Number(this._counters.get(testName));
 | 
			
		||||
    if (!key) {
 | 
			
		||||
      key = (0, _utils.testNameToKey)(testName, count);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Do not mark the snapshot as "checked" if the snapshot is inline and
 | 
			
		||||
    // there's an external snapshot. This way the external snapshot can be
 | 
			
		||||
    // removed with `--updateSnapshot`.
 | 
			
		||||
    if (!(isInline && this._snapshotData[key] !== undefined)) {
 | 
			
		||||
      this._uncheckedKeys.delete(key);
 | 
			
		||||
    }
 | 
			
		||||
    const receivedSerialized = (0, _utils.addExtraLineBreaks)(
 | 
			
		||||
      (0, _utils.serialize)(received, undefined, this.snapshotFormat)
 | 
			
		||||
    );
 | 
			
		||||
    const expected = isInline ? inlineSnapshot : this._snapshotData[key];
 | 
			
		||||
    const pass = expected === receivedSerialized;
 | 
			
		||||
    const hasSnapshot = expected !== undefined;
 | 
			
		||||
    const snapshotIsPersisted = isInline || fs.existsSync(this._snapshotPath);
 | 
			
		||||
    if (pass && !isInline) {
 | 
			
		||||
      // Executing a snapshot file as JavaScript and writing the strings back
 | 
			
		||||
      // when other snapshots have changed loses the proper escaping for some
 | 
			
		||||
      // characters. Since we check every snapshot in every test, use the newly
 | 
			
		||||
      // generated formatted string.
 | 
			
		||||
      // Note that this is only relevant when a snapshot is added and the dirty
 | 
			
		||||
      // flag is set.
 | 
			
		||||
      this._snapshotData[key] = receivedSerialized;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // These are the conditions on when to write snapshots:
 | 
			
		||||
    //  * There's no snapshot file in a non-CI environment.
 | 
			
		||||
    //  * There is a snapshot file and we decided to update the snapshot.
 | 
			
		||||
    //  * There is a snapshot file, but it doesn't have this snaphsot.
 | 
			
		||||
    // These are the conditions on when not to write snapshots:
 | 
			
		||||
    //  * The update flag is set to 'none'.
 | 
			
		||||
    //  * There's no snapshot file or a file without this snapshot on a CI environment.
 | 
			
		||||
    if (
 | 
			
		||||
      (hasSnapshot && this._updateSnapshot === 'all') ||
 | 
			
		||||
      ((!hasSnapshot || !snapshotIsPersisted) &&
 | 
			
		||||
        (this._updateSnapshot === 'new' || this._updateSnapshot === 'all'))
 | 
			
		||||
    ) {
 | 
			
		||||
      if (this._updateSnapshot === 'all') {
 | 
			
		||||
        if (!pass) {
 | 
			
		||||
          if (hasSnapshot) {
 | 
			
		||||
            this.updated++;
 | 
			
		||||
          } else {
 | 
			
		||||
            this.added++;
 | 
			
		||||
          }
 | 
			
		||||
          this._addSnapshot(key, receivedSerialized, {
 | 
			
		||||
            error,
 | 
			
		||||
            isInline
 | 
			
		||||
          });
 | 
			
		||||
        } else {
 | 
			
		||||
          this.matched++;
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        this._addSnapshot(key, receivedSerialized, {
 | 
			
		||||
          error,
 | 
			
		||||
          isInline
 | 
			
		||||
        });
 | 
			
		||||
        this.added++;
 | 
			
		||||
      }
 | 
			
		||||
      return {
 | 
			
		||||
        actual: '',
 | 
			
		||||
        count,
 | 
			
		||||
        expected: '',
 | 
			
		||||
        key,
 | 
			
		||||
        pass: true
 | 
			
		||||
      };
 | 
			
		||||
    } else {
 | 
			
		||||
      if (!pass) {
 | 
			
		||||
        this.unmatched++;
 | 
			
		||||
        return {
 | 
			
		||||
          actual: (0, _utils.removeExtraLineBreaks)(receivedSerialized),
 | 
			
		||||
          count,
 | 
			
		||||
          expected:
 | 
			
		||||
            expected !== undefined
 | 
			
		||||
              ? (0, _utils.removeExtraLineBreaks)(expected)
 | 
			
		||||
              : undefined,
 | 
			
		||||
          key,
 | 
			
		||||
          pass: false
 | 
			
		||||
        };
 | 
			
		||||
      } else {
 | 
			
		||||
        this.matched++;
 | 
			
		||||
        return {
 | 
			
		||||
          actual: '',
 | 
			
		||||
          count,
 | 
			
		||||
          expected: '',
 | 
			
		||||
          key,
 | 
			
		||||
          pass: true
 | 
			
		||||
        };
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  fail(testName, _received, key) {
 | 
			
		||||
    this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
 | 
			
		||||
    const count = Number(this._counters.get(testName));
 | 
			
		||||
    if (!key) {
 | 
			
		||||
      key = (0, _utils.testNameToKey)(testName, count);
 | 
			
		||||
    }
 | 
			
		||||
    this._uncheckedKeys.delete(key);
 | 
			
		||||
    this.unmatched++;
 | 
			
		||||
    return key;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
exports.default = SnapshotState;
 | 
			
		||||
							
								
								
									
										39
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/colors.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/colors.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.bForeground3 =
 | 
			
		||||
  exports.bForeground2 =
 | 
			
		||||
  exports.bBackground3 =
 | 
			
		||||
  exports.bBackground2 =
 | 
			
		||||
  exports.aForeground3 =
 | 
			
		||||
  exports.aForeground2 =
 | 
			
		||||
  exports.aBackground3 =
 | 
			
		||||
  exports.aBackground2 =
 | 
			
		||||
    void 0;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// https://jonasjacek.github.io/colors/
 | 
			
		||||
 | 
			
		||||
const aForeground2 = 90;
 | 
			
		||||
exports.aForeground2 = aForeground2;
 | 
			
		||||
const aBackground2 = 225;
 | 
			
		||||
exports.aBackground2 = aBackground2;
 | 
			
		||||
const bForeground2 = 23;
 | 
			
		||||
exports.bForeground2 = bForeground2;
 | 
			
		||||
const bBackground2 = 195;
 | 
			
		||||
exports.bBackground2 = bBackground2;
 | 
			
		||||
const aForeground3 = [0x80, 0, 0x80];
 | 
			
		||||
exports.aForeground3 = aForeground3;
 | 
			
		||||
const aBackground3 = [0xff, 0xd7, 0xff];
 | 
			
		||||
exports.aBackground3 = aBackground3;
 | 
			
		||||
const bForeground3 = [0, 0x5f, 0x5f];
 | 
			
		||||
exports.bForeground3 = bForeground3;
 | 
			
		||||
const bBackground3 = [0xd7, 0xff, 0xff];
 | 
			
		||||
exports.bBackground3 = bBackground3;
 | 
			
		||||
							
								
								
									
										132
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/dedentLines.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/dedentLines.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,132 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.dedentLines = void 0;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const getIndentationLength = line => {
 | 
			
		||||
  const result = /^( {2})+/.exec(line);
 | 
			
		||||
  return result === null ? 0 : result[0].length;
 | 
			
		||||
};
 | 
			
		||||
const dedentLine = line => line.slice(getIndentationLength(line));
 | 
			
		||||
 | 
			
		||||
// Return true if:
 | 
			
		||||
// "key": "value has multiple lines\n…
 | 
			
		||||
// "key has multiple lines\n…
 | 
			
		||||
const hasUnmatchedDoubleQuoteMarks = string => {
 | 
			
		||||
  let n = 0;
 | 
			
		||||
  let i = string.indexOf('"', 0);
 | 
			
		||||
  while (i !== -1) {
 | 
			
		||||
    if (i === 0 || string[i - 1] !== '\\') {
 | 
			
		||||
      n += 1;
 | 
			
		||||
    }
 | 
			
		||||
    i = string.indexOf('"', i + 1);
 | 
			
		||||
  }
 | 
			
		||||
  return n % 2 !== 0;
 | 
			
		||||
};
 | 
			
		||||
const isFirstLineOfTag = line => /^( {2})*</.test(line);
 | 
			
		||||
 | 
			
		||||
// The length of the output array is the index of the next input line.
 | 
			
		||||
 | 
			
		||||
// Push dedented lines of start tag onto output and return true;
 | 
			
		||||
// otherwise return false because:
 | 
			
		||||
// * props include a multiline string (or text node, if props have markup)
 | 
			
		||||
// * start tag does not close
 | 
			
		||||
const dedentStartTag = (input, output) => {
 | 
			
		||||
  let line = input[output.length];
 | 
			
		||||
  output.push(dedentLine(line));
 | 
			
		||||
  if (line.includes('>')) {
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
  while (output.length < input.length) {
 | 
			
		||||
    line = input[output.length];
 | 
			
		||||
    if (hasUnmatchedDoubleQuoteMarks(line)) {
 | 
			
		||||
      return false; // because props include a multiline string
 | 
			
		||||
    } else if (isFirstLineOfTag(line)) {
 | 
			
		||||
      // Recursion only if props have markup.
 | 
			
		||||
      if (!dedentMarkup(input, output)) {
 | 
			
		||||
        return false;
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      output.push(dedentLine(line));
 | 
			
		||||
      if (line.includes('>')) {
 | 
			
		||||
        return true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return false;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Push dedented lines of markup onto output and return true;
 | 
			
		||||
// otherwise return false because:
 | 
			
		||||
// * props include a multiline string
 | 
			
		||||
// * text has more than one adjacent line
 | 
			
		||||
// * markup does not close
 | 
			
		||||
const dedentMarkup = (input, output) => {
 | 
			
		||||
  let line = input[output.length];
 | 
			
		||||
  if (!dedentStartTag(input, output)) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  if (input[output.length - 1].includes('/>')) {
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
  let isText = false;
 | 
			
		||||
  const stack = [];
 | 
			
		||||
  stack.push(getIndentationLength(line));
 | 
			
		||||
  while (stack.length > 0 && output.length < input.length) {
 | 
			
		||||
    line = input[output.length];
 | 
			
		||||
    if (isFirstLineOfTag(line)) {
 | 
			
		||||
      if (line.includes('</')) {
 | 
			
		||||
        output.push(dedentLine(line));
 | 
			
		||||
        stack.pop();
 | 
			
		||||
      } else {
 | 
			
		||||
        if (!dedentStartTag(input, output)) {
 | 
			
		||||
          return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!input[output.length - 1].includes('/>')) {
 | 
			
		||||
          stack.push(getIndentationLength(line));
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      isText = false;
 | 
			
		||||
    } else {
 | 
			
		||||
      if (isText) {
 | 
			
		||||
        return false; // because text has more than one adjacent line
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const indentationLengthOfTag = stack[stack.length - 1];
 | 
			
		||||
      output.push(line.slice(indentationLengthOfTag + 2));
 | 
			
		||||
      isText = true;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return stack.length === 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Return lines unindented by heuristic;
 | 
			
		||||
// otherwise return null because:
 | 
			
		||||
// * props include a multiline string
 | 
			
		||||
// * text has more than one adjacent line
 | 
			
		||||
// * markup does not close
 | 
			
		||||
const dedentLines = input => {
 | 
			
		||||
  const output = [];
 | 
			
		||||
  while (output.length < input.length) {
 | 
			
		||||
    const line = input[output.length];
 | 
			
		||||
    if (hasUnmatchedDoubleQuoteMarks(line)) {
 | 
			
		||||
      return null;
 | 
			
		||||
    } else if (isFirstLineOfTag(line)) {
 | 
			
		||||
      if (!dedentMarkup(input, output)) {
 | 
			
		||||
        return null;
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      output.push(dedentLine(line));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return output;
 | 
			
		||||
};
 | 
			
		||||
exports.dedentLines = dedentLines;
 | 
			
		||||
							
								
								
									
										186
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										186
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,186 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
import type {Config} from '@jest/types';
 | 
			
		||||
import type {MatcherContext} from 'expect';
 | 
			
		||||
import type {MatcherFunctionWithContext} from 'expect';
 | 
			
		||||
import {Plugin as Plugin_2} from 'pretty-format';
 | 
			
		||||
import {Plugins} from 'pretty-format';
 | 
			
		||||
import type {PrettyFormatOptions} from 'pretty-format';
 | 
			
		||||
 | 
			
		||||
export declare const addSerializer: (plugin: Plugin_2) => void;
 | 
			
		||||
 | 
			
		||||
export declare const buildSnapshotResolver: (
 | 
			
		||||
  config: Config.ProjectConfig,
 | 
			
		||||
  localRequire?: Promise<LocalRequire> | LocalRequire,
 | 
			
		||||
) => Promise<SnapshotResolver>;
 | 
			
		||||
 | 
			
		||||
export declare const cleanup: (
 | 
			
		||||
  fileSystem: FileSystem_2,
 | 
			
		||||
  update: Config.SnapshotUpdateState,
 | 
			
		||||
  snapshotResolver: SnapshotResolver,
 | 
			
		||||
  testPathIgnorePatterns?: Config.ProjectConfig['testPathIgnorePatterns'],
 | 
			
		||||
) => {
 | 
			
		||||
  filesRemoved: number;
 | 
			
		||||
  filesRemovedList: Array<string>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export declare interface Context extends MatcherContext {
 | 
			
		||||
  snapshotState: SnapshotState;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export declare const EXTENSION = 'snap';
 | 
			
		||||
 | 
			
		||||
declare interface FileSystem_2 {
 | 
			
		||||
  exists(path: string): boolean;
 | 
			
		||||
  matchFiles(pattern: RegExp | string): Array<string>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export declare const getSerializers: () => Plugins;
 | 
			
		||||
 | 
			
		||||
export declare const isSnapshotPath: (path: string) => boolean;
 | 
			
		||||
 | 
			
		||||
declare type LocalRequire = (module: string) => unknown;
 | 
			
		||||
 | 
			
		||||
declare type SaveStatus = {
 | 
			
		||||
  deleted: boolean;
 | 
			
		||||
  saved: boolean;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
declare type SnapshotFormat = Omit<PrettyFormatOptions, 'compareKeys'>;
 | 
			
		||||
 | 
			
		||||
export declare interface SnapshotMatchers<R extends void | Promise<void>, T> {
 | 
			
		||||
  /**
 | 
			
		||||
   * This ensures that a value matches the most recent snapshot with property matchers.
 | 
			
		||||
   * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
 | 
			
		||||
   */
 | 
			
		||||
  toMatchSnapshot(hint?: string): R;
 | 
			
		||||
  /**
 | 
			
		||||
   * This ensures that a value matches the most recent snapshot.
 | 
			
		||||
   * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
 | 
			
		||||
   */
 | 
			
		||||
  toMatchSnapshot<U extends Record<keyof T, unknown>>(
 | 
			
		||||
    propertyMatchers: Partial<U>,
 | 
			
		||||
    hint?: string,
 | 
			
		||||
  ): R;
 | 
			
		||||
  /**
 | 
			
		||||
   * This ensures that a value matches the most recent snapshot with property matchers.
 | 
			
		||||
   * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
 | 
			
		||||
   * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
 | 
			
		||||
   */
 | 
			
		||||
  toMatchInlineSnapshot(snapshot?: string): R;
 | 
			
		||||
  /**
 | 
			
		||||
   * This ensures that a value matches the most recent snapshot with property matchers.
 | 
			
		||||
   * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
 | 
			
		||||
   * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
 | 
			
		||||
   */
 | 
			
		||||
  toMatchInlineSnapshot<U extends Record<keyof T, unknown>>(
 | 
			
		||||
    propertyMatchers: Partial<U>,
 | 
			
		||||
    snapshot?: string,
 | 
			
		||||
  ): R;
 | 
			
		||||
  /**
 | 
			
		||||
   * Used to test that a function throws a error matching the most recent snapshot when it is called.
 | 
			
		||||
   */
 | 
			
		||||
  toThrowErrorMatchingSnapshot(hint?: string): R;
 | 
			
		||||
  /**
 | 
			
		||||
   * Used to test that a function throws a error matching the most recent snapshot when it is called.
 | 
			
		||||
   * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
 | 
			
		||||
   */
 | 
			
		||||
  toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
declare type SnapshotMatchOptions = {
 | 
			
		||||
  readonly testName: string;
 | 
			
		||||
  readonly received: unknown;
 | 
			
		||||
  readonly key?: string;
 | 
			
		||||
  readonly inlineSnapshot?: string;
 | 
			
		||||
  readonly isInline: boolean;
 | 
			
		||||
  readonly error?: Error;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export declare type SnapshotResolver = {
 | 
			
		||||
  /** Resolves from `testPath` to snapshot path. */
 | 
			
		||||
  resolveSnapshotPath(testPath: string, snapshotExtension?: string): string;
 | 
			
		||||
  /** Resolves from `snapshotPath` to test path. */
 | 
			
		||||
  resolveTestPath(snapshotPath: string, snapshotExtension?: string): string;
 | 
			
		||||
  /** Example test path, used for preflight consistency check of the implementation above. */
 | 
			
		||||
  testPathForConsistencyCheck: string;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
declare type SnapshotReturnOptions = {
 | 
			
		||||
  readonly actual: string;
 | 
			
		||||
  readonly count: number;
 | 
			
		||||
  readonly expected?: string;
 | 
			
		||||
  readonly key: string;
 | 
			
		||||
  readonly pass: boolean;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export declare class SnapshotState {
 | 
			
		||||
  private _counters;
 | 
			
		||||
  private _dirty;
 | 
			
		||||
  private _index;
 | 
			
		||||
  private readonly _updateSnapshot;
 | 
			
		||||
  private _snapshotData;
 | 
			
		||||
  private readonly _initialData;
 | 
			
		||||
  private readonly _snapshotPath;
 | 
			
		||||
  private _inlineSnapshots;
 | 
			
		||||
  private readonly _uncheckedKeys;
 | 
			
		||||
  private readonly _prettierPath;
 | 
			
		||||
  private readonly _rootDir;
 | 
			
		||||
  readonly snapshotFormat: SnapshotFormat;
 | 
			
		||||
  added: number;
 | 
			
		||||
  expand: boolean;
 | 
			
		||||
  matched: number;
 | 
			
		||||
  unmatched: number;
 | 
			
		||||
  updated: number;
 | 
			
		||||
  constructor(snapshotPath: string, options: SnapshotStateOptions);
 | 
			
		||||
  markSnapshotsAsCheckedForTest(testName: string): void;
 | 
			
		||||
  private _addSnapshot;
 | 
			
		||||
  clear(): void;
 | 
			
		||||
  save(): SaveStatus;
 | 
			
		||||
  getUncheckedCount(): number;
 | 
			
		||||
  getUncheckedKeys(): Array<string>;
 | 
			
		||||
  removeUncheckedKeys(): void;
 | 
			
		||||
  match({
 | 
			
		||||
    testName,
 | 
			
		||||
    received,
 | 
			
		||||
    key,
 | 
			
		||||
    inlineSnapshot,
 | 
			
		||||
    isInline,
 | 
			
		||||
    error,
 | 
			
		||||
  }: SnapshotMatchOptions): SnapshotReturnOptions;
 | 
			
		||||
  fail(testName: string, _received: unknown, key?: string): string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
declare type SnapshotStateOptions = {
 | 
			
		||||
  readonly updateSnapshot: Config.SnapshotUpdateState;
 | 
			
		||||
  readonly prettierPath?: string | null;
 | 
			
		||||
  readonly expand?: boolean;
 | 
			
		||||
  readonly snapshotFormat: SnapshotFormat;
 | 
			
		||||
  readonly rootDir: string;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export declare const toMatchInlineSnapshot: MatcherFunctionWithContext<
 | 
			
		||||
  Context,
 | 
			
		||||
  [propertiesOrSnapshot?: object | string, inlineSnapshot?: string]
 | 
			
		||||
>;
 | 
			
		||||
 | 
			
		||||
export declare const toMatchSnapshot: MatcherFunctionWithContext<
 | 
			
		||||
  Context,
 | 
			
		||||
  [propertiesOrHint?: object | string, hint?: string]
 | 
			
		||||
>;
 | 
			
		||||
 | 
			
		||||
export declare const toThrowErrorMatchingInlineSnapshot: MatcherFunctionWithContext<
 | 
			
		||||
  Context,
 | 
			
		||||
  [inlineSnapshot?: string, fromPromise?: boolean]
 | 
			
		||||
>;
 | 
			
		||||
 | 
			
		||||
export declare const toThrowErrorMatchingSnapshot: MatcherFunctionWithContext<
 | 
			
		||||
  Context,
 | 
			
		||||
  [hint?: string, fromPromise?: boolean]
 | 
			
		||||
>;
 | 
			
		||||
 | 
			
		||||
export {};
 | 
			
		||||
							
								
								
									
										591
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										591
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,591 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
Object.defineProperty(exports, 'EXTENSION', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function () {
 | 
			
		||||
    return _SnapshotResolver.EXTENSION;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
Object.defineProperty(exports, 'SnapshotState', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function () {
 | 
			
		||||
    return _State.default;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
Object.defineProperty(exports, 'addSerializer', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function () {
 | 
			
		||||
    return _plugins.addSerializer;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
Object.defineProperty(exports, 'buildSnapshotResolver', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function () {
 | 
			
		||||
    return _SnapshotResolver.buildSnapshotResolver;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
exports.cleanup = void 0;
 | 
			
		||||
Object.defineProperty(exports, 'getSerializers', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function () {
 | 
			
		||||
    return _plugins.getSerializers;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
Object.defineProperty(exports, 'isSnapshotPath', {
 | 
			
		||||
  enumerable: true,
 | 
			
		||||
  get: function () {
 | 
			
		||||
    return _SnapshotResolver.isSnapshotPath;
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
exports.toThrowErrorMatchingSnapshot =
 | 
			
		||||
  exports.toThrowErrorMatchingInlineSnapshot =
 | 
			
		||||
  exports.toMatchSnapshot =
 | 
			
		||||
  exports.toMatchInlineSnapshot =
 | 
			
		||||
    void 0;
 | 
			
		||||
var fs = _interopRequireWildcard(require('graceful-fs'));
 | 
			
		||||
var _jestMatcherUtils = require('jest-matcher-utils');
 | 
			
		||||
var _SnapshotResolver = require('./SnapshotResolver');
 | 
			
		||||
var _printSnapshot = require('./printSnapshot');
 | 
			
		||||
var _utils = require('./utils');
 | 
			
		||||
var _plugins = require('./plugins');
 | 
			
		||||
var _State = _interopRequireDefault(require('./State'));
 | 
			
		||||
function _interopRequireDefault(obj) {
 | 
			
		||||
  return obj && obj.__esModule ? obj : {default: obj};
 | 
			
		||||
}
 | 
			
		||||
function _getRequireWildcardCache(nodeInterop) {
 | 
			
		||||
  if (typeof WeakMap !== 'function') return null;
 | 
			
		||||
  var cacheBabelInterop = new WeakMap();
 | 
			
		||||
  var cacheNodeInterop = new WeakMap();
 | 
			
		||||
  return (_getRequireWildcardCache = function (nodeInterop) {
 | 
			
		||||
    return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
 | 
			
		||||
  })(nodeInterop);
 | 
			
		||||
}
 | 
			
		||||
function _interopRequireWildcard(obj, nodeInterop) {
 | 
			
		||||
  if (!nodeInterop && obj && obj.__esModule) {
 | 
			
		||||
    return obj;
 | 
			
		||||
  }
 | 
			
		||||
  if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
 | 
			
		||||
    return {default: obj};
 | 
			
		||||
  }
 | 
			
		||||
  var cache = _getRequireWildcardCache(nodeInterop);
 | 
			
		||||
  if (cache && cache.has(obj)) {
 | 
			
		||||
    return cache.get(obj);
 | 
			
		||||
  }
 | 
			
		||||
  var newObj = {};
 | 
			
		||||
  var hasPropertyDescriptor =
 | 
			
		||||
    Object.defineProperty && Object.getOwnPropertyDescriptor;
 | 
			
		||||
  for (var key in obj) {
 | 
			
		||||
    if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
 | 
			
		||||
      var desc = hasPropertyDescriptor
 | 
			
		||||
        ? Object.getOwnPropertyDescriptor(obj, key)
 | 
			
		||||
        : null;
 | 
			
		||||
      if (desc && (desc.get || desc.set)) {
 | 
			
		||||
        Object.defineProperty(newObj, key, desc);
 | 
			
		||||
      } else {
 | 
			
		||||
        newObj[key] = obj[key];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  newObj.default = obj;
 | 
			
		||||
  if (cache) {
 | 
			
		||||
    cache.set(obj, newObj);
 | 
			
		||||
  }
 | 
			
		||||
  return newObj;
 | 
			
		||||
}
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestExistsFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-exists-file')] || fs.existsSync;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
const DID_NOT_THROW = 'Received function did not throw'; // same as toThrow
 | 
			
		||||
const NOT_SNAPSHOT_MATCHERS = `Snapshot matchers cannot be used with ${(0,
 | 
			
		||||
_jestMatcherUtils.BOLD_WEIGHT)('not')}`;
 | 
			
		||||
const INDENTATION_REGEX = /^([^\S\n]*)\S/m;
 | 
			
		||||
 | 
			
		||||
// Display name in report when matcher fails same as in snapshot file,
 | 
			
		||||
// but with optional hint argument in bold weight.
 | 
			
		||||
const printSnapshotName = (concatenatedBlockNames = '', hint = '', count) => {
 | 
			
		||||
  const hasNames = concatenatedBlockNames.length !== 0;
 | 
			
		||||
  const hasHint = hint.length !== 0;
 | 
			
		||||
  return `Snapshot name: \`${
 | 
			
		||||
    hasNames ? (0, _utils.escapeBacktickString)(concatenatedBlockNames) : ''
 | 
			
		||||
  }${hasNames && hasHint ? ': ' : ''}${
 | 
			
		||||
    hasHint
 | 
			
		||||
      ? (0, _jestMatcherUtils.BOLD_WEIGHT)(
 | 
			
		||||
          (0, _utils.escapeBacktickString)(hint)
 | 
			
		||||
        )
 | 
			
		||||
      : ''
 | 
			
		||||
  } ${count}\``;
 | 
			
		||||
};
 | 
			
		||||
function stripAddedIndentation(inlineSnapshot) {
 | 
			
		||||
  // Find indentation if exists.
 | 
			
		||||
  const match = inlineSnapshot.match(INDENTATION_REGEX);
 | 
			
		||||
  if (!match || !match[1]) {
 | 
			
		||||
    // No indentation.
 | 
			
		||||
    return inlineSnapshot;
 | 
			
		||||
  }
 | 
			
		||||
  const indentation = match[1];
 | 
			
		||||
  const lines = inlineSnapshot.split('\n');
 | 
			
		||||
  if (lines.length <= 2) {
 | 
			
		||||
    // Must be at least 3 lines.
 | 
			
		||||
    return inlineSnapshot;
 | 
			
		||||
  }
 | 
			
		||||
  if (lines[0].trim() !== '' || lines[lines.length - 1].trim() !== '') {
 | 
			
		||||
    // If not blank first and last lines, abort.
 | 
			
		||||
    return inlineSnapshot;
 | 
			
		||||
  }
 | 
			
		||||
  for (let i = 1; i < lines.length - 1; i++) {
 | 
			
		||||
    if (lines[i] !== '') {
 | 
			
		||||
      if (lines[i].indexOf(indentation) !== 0) {
 | 
			
		||||
        // All lines except first and last should either be blank or have the same
 | 
			
		||||
        // indent as the first line (or more). If this isn't the case we don't
 | 
			
		||||
        // want to touch the snapshot at all.
 | 
			
		||||
        return inlineSnapshot;
 | 
			
		||||
      }
 | 
			
		||||
      lines[i] = lines[i].substring(indentation.length);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Last line is a special case because it won't have the same indent as others
 | 
			
		||||
  // but may still have been given some indent to line up.
 | 
			
		||||
  lines[lines.length - 1] = '';
 | 
			
		||||
 | 
			
		||||
  // Return inline snapshot, now at indent 0.
 | 
			
		||||
  inlineSnapshot = lines.join('\n');
 | 
			
		||||
  return inlineSnapshot;
 | 
			
		||||
}
 | 
			
		||||
const fileExists = (filePath, fileSystem) =>
 | 
			
		||||
  fileSystem.exists(filePath) || jestExistsFile(filePath);
 | 
			
		||||
const cleanup = (
 | 
			
		||||
  fileSystem,
 | 
			
		||||
  update,
 | 
			
		||||
  snapshotResolver,
 | 
			
		||||
  testPathIgnorePatterns
 | 
			
		||||
) => {
 | 
			
		||||
  const pattern = `\\.${_SnapshotResolver.EXTENSION}$`;
 | 
			
		||||
  const files = fileSystem.matchFiles(pattern);
 | 
			
		||||
  let testIgnorePatternsRegex = null;
 | 
			
		||||
  if (testPathIgnorePatterns && testPathIgnorePatterns.length > 0) {
 | 
			
		||||
    testIgnorePatternsRegex = new RegExp(testPathIgnorePatterns.join('|'));
 | 
			
		||||
  }
 | 
			
		||||
  const list = files.filter(snapshotFile => {
 | 
			
		||||
    const testPath = snapshotResolver.resolveTestPath(snapshotFile);
 | 
			
		||||
 | 
			
		||||
    // ignore snapshots of ignored tests
 | 
			
		||||
    if (testIgnorePatternsRegex && testIgnorePatternsRegex.test(testPath)) {
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    if (!fileExists(testPath, fileSystem)) {
 | 
			
		||||
      if (update === 'all') {
 | 
			
		||||
        fs.unlinkSync(snapshotFile);
 | 
			
		||||
      }
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  });
 | 
			
		||||
  return {
 | 
			
		||||
    filesRemoved: list.length,
 | 
			
		||||
    filesRemovedList: list
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
exports.cleanup = cleanup;
 | 
			
		||||
const toMatchSnapshot = function (received, propertiesOrHint, hint) {
 | 
			
		||||
  const matcherName = 'toMatchSnapshot';
 | 
			
		||||
  let properties;
 | 
			
		||||
  const length = arguments.length;
 | 
			
		||||
  if (length === 2 && typeof propertiesOrHint === 'string') {
 | 
			
		||||
    hint = propertiesOrHint;
 | 
			
		||||
  } else if (length >= 2) {
 | 
			
		||||
    if (typeof propertiesOrHint !== 'object' || propertiesOrHint === null) {
 | 
			
		||||
      const options = {
 | 
			
		||||
        isNot: this.isNot,
 | 
			
		||||
        promise: this.promise
 | 
			
		||||
      };
 | 
			
		||||
      let printedWithType = (0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
        'Expected properties',
 | 
			
		||||
        propertiesOrHint,
 | 
			
		||||
        _printSnapshot.printExpected
 | 
			
		||||
      );
 | 
			
		||||
      if (length === 3) {
 | 
			
		||||
        options.secondArgument = 'hint';
 | 
			
		||||
        options.secondArgumentColor = _jestMatcherUtils.BOLD_WEIGHT;
 | 
			
		||||
        if (propertiesOrHint == null) {
 | 
			
		||||
          printedWithType +=
 | 
			
		||||
            "\n\nTo provide a hint without properties: toMatchSnapshot('hint')";
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      throw new Error(
 | 
			
		||||
        (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
          (0, _jestMatcherUtils.matcherHint)(
 | 
			
		||||
            matcherName,
 | 
			
		||||
            undefined,
 | 
			
		||||
            _printSnapshot.PROPERTIES_ARG,
 | 
			
		||||
            options
 | 
			
		||||
          ),
 | 
			
		||||
          `Expected ${(0, _jestMatcherUtils.EXPECTED_COLOR)(
 | 
			
		||||
            'properties'
 | 
			
		||||
          )} must be an object`,
 | 
			
		||||
          printedWithType
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Future breaking change: Snapshot hint must be a string
 | 
			
		||||
    // if (arguments.length === 3 && typeof hint !== 'string') {}
 | 
			
		||||
 | 
			
		||||
    properties = propertiesOrHint;
 | 
			
		||||
  }
 | 
			
		||||
  return _toMatchSnapshot({
 | 
			
		||||
    context: this,
 | 
			
		||||
    hint,
 | 
			
		||||
    isInline: false,
 | 
			
		||||
    matcherName,
 | 
			
		||||
    properties,
 | 
			
		||||
    received
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
exports.toMatchSnapshot = toMatchSnapshot;
 | 
			
		||||
const toMatchInlineSnapshot = function (
 | 
			
		||||
  received,
 | 
			
		||||
  propertiesOrSnapshot,
 | 
			
		||||
  inlineSnapshot
 | 
			
		||||
) {
 | 
			
		||||
  const matcherName = 'toMatchInlineSnapshot';
 | 
			
		||||
  let properties;
 | 
			
		||||
  const length = arguments.length;
 | 
			
		||||
  if (length === 2 && typeof propertiesOrSnapshot === 'string') {
 | 
			
		||||
    inlineSnapshot = propertiesOrSnapshot;
 | 
			
		||||
  } else if (length >= 2) {
 | 
			
		||||
    const options = {
 | 
			
		||||
      isNot: this.isNot,
 | 
			
		||||
      promise: this.promise
 | 
			
		||||
    };
 | 
			
		||||
    if (length === 3) {
 | 
			
		||||
      options.secondArgument = _printSnapshot.SNAPSHOT_ARG;
 | 
			
		||||
      options.secondArgumentColor = _printSnapshot.noColor;
 | 
			
		||||
    }
 | 
			
		||||
    if (
 | 
			
		||||
      typeof propertiesOrSnapshot !== 'object' ||
 | 
			
		||||
      propertiesOrSnapshot === null
 | 
			
		||||
    ) {
 | 
			
		||||
      throw new Error(
 | 
			
		||||
        (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
          (0, _jestMatcherUtils.matcherHint)(
 | 
			
		||||
            matcherName,
 | 
			
		||||
            undefined,
 | 
			
		||||
            _printSnapshot.PROPERTIES_ARG,
 | 
			
		||||
            options
 | 
			
		||||
          ),
 | 
			
		||||
          `Expected ${(0, _jestMatcherUtils.EXPECTED_COLOR)(
 | 
			
		||||
            'properties'
 | 
			
		||||
          )} must be an object`,
 | 
			
		||||
          (0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
            'Expected properties',
 | 
			
		||||
            propertiesOrSnapshot,
 | 
			
		||||
            _printSnapshot.printExpected
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    if (length === 3 && typeof inlineSnapshot !== 'string') {
 | 
			
		||||
      throw new Error(
 | 
			
		||||
        (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
          (0, _jestMatcherUtils.matcherHint)(
 | 
			
		||||
            matcherName,
 | 
			
		||||
            undefined,
 | 
			
		||||
            _printSnapshot.PROPERTIES_ARG,
 | 
			
		||||
            options
 | 
			
		||||
          ),
 | 
			
		||||
          'Inline snapshot must be a string',
 | 
			
		||||
          (0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
            'Inline snapshot',
 | 
			
		||||
            inlineSnapshot,
 | 
			
		||||
            _utils.serialize
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    properties = propertiesOrSnapshot;
 | 
			
		||||
  }
 | 
			
		||||
  return _toMatchSnapshot({
 | 
			
		||||
    context: this,
 | 
			
		||||
    inlineSnapshot:
 | 
			
		||||
      inlineSnapshot !== undefined
 | 
			
		||||
        ? stripAddedIndentation(inlineSnapshot)
 | 
			
		||||
        : undefined,
 | 
			
		||||
    isInline: true,
 | 
			
		||||
    matcherName,
 | 
			
		||||
    properties,
 | 
			
		||||
    received
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
exports.toMatchInlineSnapshot = toMatchInlineSnapshot;
 | 
			
		||||
const _toMatchSnapshot = config => {
 | 
			
		||||
  const {context, hint, inlineSnapshot, isInline, matcherName, properties} =
 | 
			
		||||
    config;
 | 
			
		||||
  let {received} = config;
 | 
			
		||||
  context.dontThrow && context.dontThrow();
 | 
			
		||||
  const {currentConcurrentTestName, isNot, snapshotState} = context;
 | 
			
		||||
  const currentTestName =
 | 
			
		||||
    currentConcurrentTestName?.() ?? context.currentTestName;
 | 
			
		||||
  if (isNot) {
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
        (0, _printSnapshot.matcherHintFromConfig)(config, false),
 | 
			
		||||
        NOT_SNAPSHOT_MATCHERS
 | 
			
		||||
      )
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  if (snapshotState == null) {
 | 
			
		||||
    // Because the state is the problem, this is not a matcher error.
 | 
			
		||||
    // Call generic stringify from jest-matcher-utils package
 | 
			
		||||
    // because uninitialized snapshot state does not need snapshot serializers.
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      `${(0, _printSnapshot.matcherHintFromConfig)(config, false)}\n\n` +
 | 
			
		||||
        'Snapshot state must be initialized' +
 | 
			
		||||
        `\n\n${(0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
          'Snapshot state',
 | 
			
		||||
          snapshotState,
 | 
			
		||||
          _jestMatcherUtils.stringify
 | 
			
		||||
        )}`
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  const fullTestName =
 | 
			
		||||
    currentTestName && hint
 | 
			
		||||
      ? `${currentTestName}: ${hint}`
 | 
			
		||||
      : currentTestName || ''; // future BREAKING change: || hint
 | 
			
		||||
 | 
			
		||||
  if (typeof properties === 'object') {
 | 
			
		||||
    if (typeof received !== 'object' || received === null) {
 | 
			
		||||
      throw new Error(
 | 
			
		||||
        (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
          (0, _printSnapshot.matcherHintFromConfig)(config, false),
 | 
			
		||||
          `${(0, _jestMatcherUtils.RECEIVED_COLOR)(
 | 
			
		||||
            'received'
 | 
			
		||||
          )} value must be an object when the matcher has ${(0,
 | 
			
		||||
          _jestMatcherUtils.EXPECTED_COLOR)('properties')}`,
 | 
			
		||||
          (0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
            'Received',
 | 
			
		||||
            received,
 | 
			
		||||
            _printSnapshot.printReceived
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    const propertyPass = context.equals(received, properties, [
 | 
			
		||||
      context.utils.iterableEquality,
 | 
			
		||||
      context.utils.subsetEquality
 | 
			
		||||
    ]);
 | 
			
		||||
    if (!propertyPass) {
 | 
			
		||||
      const key = snapshotState.fail(fullTestName, received);
 | 
			
		||||
      const matched = /(\d+)$/.exec(key);
 | 
			
		||||
      const count = matched === null ? 1 : Number(matched[1]);
 | 
			
		||||
      const message = () =>
 | 
			
		||||
        `${(0, _printSnapshot.matcherHintFromConfig)(
 | 
			
		||||
          config,
 | 
			
		||||
          false
 | 
			
		||||
        )}\n\n${printSnapshotName(currentTestName, hint, count)}\n\n${(0,
 | 
			
		||||
        _printSnapshot.printPropertiesAndReceived)(
 | 
			
		||||
          properties,
 | 
			
		||||
          received,
 | 
			
		||||
          snapshotState.expand
 | 
			
		||||
        )}`;
 | 
			
		||||
      return {
 | 
			
		||||
        message,
 | 
			
		||||
        name: matcherName,
 | 
			
		||||
        pass: false
 | 
			
		||||
      };
 | 
			
		||||
    } else {
 | 
			
		||||
      received = (0, _utils.deepMerge)(received, properties);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  const result = snapshotState.match({
 | 
			
		||||
    error: context.error,
 | 
			
		||||
    inlineSnapshot,
 | 
			
		||||
    isInline,
 | 
			
		||||
    received,
 | 
			
		||||
    testName: fullTestName
 | 
			
		||||
  });
 | 
			
		||||
  const {actual, count, expected, pass} = result;
 | 
			
		||||
  if (pass) {
 | 
			
		||||
    return {
 | 
			
		||||
      message: () => '',
 | 
			
		||||
      pass: true
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
  const message =
 | 
			
		||||
    expected === undefined
 | 
			
		||||
      ? () =>
 | 
			
		||||
          `${(0, _printSnapshot.matcherHintFromConfig)(
 | 
			
		||||
            config,
 | 
			
		||||
            true
 | 
			
		||||
          )}\n\n${printSnapshotName(currentTestName, hint, count)}\n\n` +
 | 
			
		||||
          `New snapshot was ${(0, _jestMatcherUtils.BOLD_WEIGHT)(
 | 
			
		||||
            'not written'
 | 
			
		||||
          )}. The update flag ` +
 | 
			
		||||
          'must be explicitly passed to write a new snapshot.\n\n' +
 | 
			
		||||
          'This is likely because this test is run in a continuous integration ' +
 | 
			
		||||
          '(CI) environment in which snapshots are not written by default.\n\n' +
 | 
			
		||||
          `Received:${actual.includes('\n') ? '\n' : ' '}${(0,
 | 
			
		||||
          _printSnapshot.bReceivedColor)(actual)}`
 | 
			
		||||
      : () =>
 | 
			
		||||
          `${(0, _printSnapshot.matcherHintFromConfig)(
 | 
			
		||||
            config,
 | 
			
		||||
            true
 | 
			
		||||
          )}\n\n${printSnapshotName(currentTestName, hint, count)}\n\n${(0,
 | 
			
		||||
          _printSnapshot.printSnapshotAndReceived)(
 | 
			
		||||
            expected,
 | 
			
		||||
            actual,
 | 
			
		||||
            received,
 | 
			
		||||
            snapshotState.expand,
 | 
			
		||||
            snapshotState.snapshotFormat
 | 
			
		||||
          )}`;
 | 
			
		||||
 | 
			
		||||
  // Passing the actual and expected objects so that a custom reporter
 | 
			
		||||
  // could access them, for example in order to display a custom visual diff,
 | 
			
		||||
  // or create a different error message
 | 
			
		||||
  return {
 | 
			
		||||
    actual,
 | 
			
		||||
    expected,
 | 
			
		||||
    message,
 | 
			
		||||
    name: matcherName,
 | 
			
		||||
    pass: false
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
const toThrowErrorMatchingSnapshot = function (received, hint, fromPromise) {
 | 
			
		||||
  const matcherName = 'toThrowErrorMatchingSnapshot';
 | 
			
		||||
 | 
			
		||||
  // Future breaking change: Snapshot hint must be a string
 | 
			
		||||
  // if (hint !== undefined && typeof hint !== string) {}
 | 
			
		||||
 | 
			
		||||
  return _toThrowErrorMatchingSnapshot(
 | 
			
		||||
    {
 | 
			
		||||
      context: this,
 | 
			
		||||
      hint,
 | 
			
		||||
      isInline: false,
 | 
			
		||||
      matcherName,
 | 
			
		||||
      received
 | 
			
		||||
    },
 | 
			
		||||
    fromPromise
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
exports.toThrowErrorMatchingSnapshot = toThrowErrorMatchingSnapshot;
 | 
			
		||||
const toThrowErrorMatchingInlineSnapshot = function (
 | 
			
		||||
  received,
 | 
			
		||||
  inlineSnapshot,
 | 
			
		||||
  fromPromise
 | 
			
		||||
) {
 | 
			
		||||
  const matcherName = 'toThrowErrorMatchingInlineSnapshot';
 | 
			
		||||
  if (inlineSnapshot !== undefined && typeof inlineSnapshot !== 'string') {
 | 
			
		||||
    const options = {
 | 
			
		||||
      expectedColor: _printSnapshot.noColor,
 | 
			
		||||
      isNot: this.isNot,
 | 
			
		||||
      promise: this.promise
 | 
			
		||||
    };
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
        (0, _jestMatcherUtils.matcherHint)(
 | 
			
		||||
          matcherName,
 | 
			
		||||
          undefined,
 | 
			
		||||
          _printSnapshot.SNAPSHOT_ARG,
 | 
			
		||||
          options
 | 
			
		||||
        ),
 | 
			
		||||
        'Inline snapshot must be a string',
 | 
			
		||||
        (0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
          'Inline snapshot',
 | 
			
		||||
          inlineSnapshot,
 | 
			
		||||
          _utils.serialize
 | 
			
		||||
        )
 | 
			
		||||
      )
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  return _toThrowErrorMatchingSnapshot(
 | 
			
		||||
    {
 | 
			
		||||
      context: this,
 | 
			
		||||
      inlineSnapshot:
 | 
			
		||||
        inlineSnapshot !== undefined
 | 
			
		||||
          ? stripAddedIndentation(inlineSnapshot)
 | 
			
		||||
          : undefined,
 | 
			
		||||
      isInline: true,
 | 
			
		||||
      matcherName,
 | 
			
		||||
      received
 | 
			
		||||
    },
 | 
			
		||||
    fromPromise
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
exports.toThrowErrorMatchingInlineSnapshot = toThrowErrorMatchingInlineSnapshot;
 | 
			
		||||
const _toThrowErrorMatchingSnapshot = (config, fromPromise) => {
 | 
			
		||||
  const {context, hint, inlineSnapshot, isInline, matcherName, received} =
 | 
			
		||||
    config;
 | 
			
		||||
  context.dontThrow && context.dontThrow();
 | 
			
		||||
  const {isNot, promise} = context;
 | 
			
		||||
  if (!fromPromise) {
 | 
			
		||||
    if (typeof received !== 'function') {
 | 
			
		||||
      const options = {
 | 
			
		||||
        isNot,
 | 
			
		||||
        promise
 | 
			
		||||
      };
 | 
			
		||||
      throw new Error(
 | 
			
		||||
        (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
          (0, _jestMatcherUtils.matcherHint)(
 | 
			
		||||
            matcherName,
 | 
			
		||||
            undefined,
 | 
			
		||||
            '',
 | 
			
		||||
            options
 | 
			
		||||
          ),
 | 
			
		||||
          `${(0, _jestMatcherUtils.RECEIVED_COLOR)(
 | 
			
		||||
            'received'
 | 
			
		||||
          )} value must be a function`,
 | 
			
		||||
          (0, _jestMatcherUtils.printWithType)(
 | 
			
		||||
            'Received',
 | 
			
		||||
            received,
 | 
			
		||||
            _printSnapshot.printReceived
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (isNot) {
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      (0, _jestMatcherUtils.matcherErrorMessage)(
 | 
			
		||||
        (0, _printSnapshot.matcherHintFromConfig)(config, false),
 | 
			
		||||
        NOT_SNAPSHOT_MATCHERS
 | 
			
		||||
      )
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  let error;
 | 
			
		||||
  if (fromPromise) {
 | 
			
		||||
    error = received;
 | 
			
		||||
  } else {
 | 
			
		||||
    try {
 | 
			
		||||
      received();
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      error = e;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (error === undefined) {
 | 
			
		||||
    // Because the received value is a function, this is not a matcher error.
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      `${(0, _printSnapshot.matcherHintFromConfig)(
 | 
			
		||||
        config,
 | 
			
		||||
        false
 | 
			
		||||
      )}\n\n${DID_NOT_THROW}`
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  return _toMatchSnapshot({
 | 
			
		||||
    context,
 | 
			
		||||
    hint,
 | 
			
		||||
    inlineSnapshot,
 | 
			
		||||
    isInline,
 | 
			
		||||
    matcherName,
 | 
			
		||||
    received: error.message
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										47
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/mockSerializer.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/mockSerializer.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.test = exports.serialize = exports.default = void 0;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const serialize = (val, config, indentation, depth, refs, printer) => {
 | 
			
		||||
  // Serialize a non-default name, even if config.printFunctionName is false.
 | 
			
		||||
  const name = val.getMockName();
 | 
			
		||||
  const nameString = name === 'jest.fn()' ? '' : ` ${name}`;
 | 
			
		||||
  let callsString = '';
 | 
			
		||||
  if (val.mock.calls.length !== 0) {
 | 
			
		||||
    const indentationNext = indentation + config.indent;
 | 
			
		||||
    callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(
 | 
			
		||||
      val.mock.calls,
 | 
			
		||||
      config,
 | 
			
		||||
      indentationNext,
 | 
			
		||||
      depth,
 | 
			
		||||
      refs
 | 
			
		||||
    )}${config.min ? ', ' : ','}${
 | 
			
		||||
      config.spacingOuter
 | 
			
		||||
    }${indentationNext}"results": ${printer(
 | 
			
		||||
      val.mock.results,
 | 
			
		||||
      config,
 | 
			
		||||
      indentationNext,
 | 
			
		||||
      depth,
 | 
			
		||||
      refs
 | 
			
		||||
    )}${config.min ? '' : ','}${config.spacingOuter}${indentation}}`;
 | 
			
		||||
  }
 | 
			
		||||
  return `[MockFunction${nameString}]${callsString}`;
 | 
			
		||||
};
 | 
			
		||||
exports.serialize = serialize;
 | 
			
		||||
const test = val => val && !!val._isMockFunction;
 | 
			
		||||
exports.test = test;
 | 
			
		||||
const plugin = {
 | 
			
		||||
  serialize,
 | 
			
		||||
  test
 | 
			
		||||
};
 | 
			
		||||
var _default = plugin;
 | 
			
		||||
exports.default = _default;
 | 
			
		||||
							
								
								
									
										43
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/plugins.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/plugins.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.getSerializers = exports.addSerializer = void 0;
 | 
			
		||||
var _prettyFormat = require('pretty-format');
 | 
			
		||||
var _mockSerializer = _interopRequireDefault(require('./mockSerializer'));
 | 
			
		||||
function _interopRequireDefault(obj) {
 | 
			
		||||
  return obj && obj.__esModule ? obj : {default: obj};
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const {
 | 
			
		||||
  DOMCollection,
 | 
			
		||||
  DOMElement,
 | 
			
		||||
  Immutable,
 | 
			
		||||
  ReactElement,
 | 
			
		||||
  ReactTestComponent,
 | 
			
		||||
  AsymmetricMatcher
 | 
			
		||||
} = _prettyFormat.plugins;
 | 
			
		||||
let PLUGINS = [
 | 
			
		||||
  ReactTestComponent,
 | 
			
		||||
  ReactElement,
 | 
			
		||||
  DOMElement,
 | 
			
		||||
  DOMCollection,
 | 
			
		||||
  Immutable,
 | 
			
		||||
  _mockSerializer.default,
 | 
			
		||||
  AsymmetricMatcher
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
// Prepend to list so the last added is the first tested.
 | 
			
		||||
const addSerializer = plugin => {
 | 
			
		||||
  PLUGINS = [plugin].concat(PLUGINS);
 | 
			
		||||
};
 | 
			
		||||
exports.addSerializer = addSerializer;
 | 
			
		||||
const getSerializers = () => PLUGINS;
 | 
			
		||||
exports.getSerializers = getSerializers;
 | 
			
		||||
							
								
								
									
										340
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/printSnapshot.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										340
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/printSnapshot.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,340 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.printSnapshotAndReceived =
 | 
			
		||||
  exports.printReceived =
 | 
			
		||||
  exports.printPropertiesAndReceived =
 | 
			
		||||
  exports.printExpected =
 | 
			
		||||
  exports.noColor =
 | 
			
		||||
  exports.matcherHintFromConfig =
 | 
			
		||||
  exports.getSnapshotColorForChalkInstance =
 | 
			
		||||
  exports.getReceivedColorForChalkInstance =
 | 
			
		||||
  exports.bReceivedColor =
 | 
			
		||||
  exports.aSnapshotColor =
 | 
			
		||||
  exports.SNAPSHOT_ARG =
 | 
			
		||||
  exports.PROPERTIES_ARG =
 | 
			
		||||
  exports.HINT_ARG =
 | 
			
		||||
    void 0;
 | 
			
		||||
var _chalk = _interopRequireDefault(require('chalk'));
 | 
			
		||||
var _expectUtils = require('@jest/expect-utils');
 | 
			
		||||
var _jestDiff = require('jest-diff');
 | 
			
		||||
var _jestGetType = require('jest-get-type');
 | 
			
		||||
var _jestMatcherUtils = require('jest-matcher-utils');
 | 
			
		||||
var _prettyFormat = require('pretty-format');
 | 
			
		||||
var _colors = require('./colors');
 | 
			
		||||
var _dedentLines = require('./dedentLines');
 | 
			
		||||
var _utils = require('./utils');
 | 
			
		||||
function _interopRequireDefault(obj) {
 | 
			
		||||
  return obj && obj.__esModule ? obj : {default: obj};
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const getSnapshotColorForChalkInstance = chalkInstance => {
 | 
			
		||||
  const level = chalkInstance.level;
 | 
			
		||||
  if (level === 3) {
 | 
			
		||||
    return chalkInstance
 | 
			
		||||
      .rgb(
 | 
			
		||||
        _colors.aForeground3[0],
 | 
			
		||||
        _colors.aForeground3[1],
 | 
			
		||||
        _colors.aForeground3[2]
 | 
			
		||||
      )
 | 
			
		||||
      .bgRgb(
 | 
			
		||||
        _colors.aBackground3[0],
 | 
			
		||||
        _colors.aBackground3[1],
 | 
			
		||||
        _colors.aBackground3[2]
 | 
			
		||||
      );
 | 
			
		||||
  }
 | 
			
		||||
  if (level === 2) {
 | 
			
		||||
    return chalkInstance
 | 
			
		||||
      .ansi256(_colors.aForeground2)
 | 
			
		||||
      .bgAnsi256(_colors.aBackground2);
 | 
			
		||||
  }
 | 
			
		||||
  return chalkInstance.magenta.bgYellowBright;
 | 
			
		||||
};
 | 
			
		||||
exports.getSnapshotColorForChalkInstance = getSnapshotColorForChalkInstance;
 | 
			
		||||
const getReceivedColorForChalkInstance = chalkInstance => {
 | 
			
		||||
  const level = chalkInstance.level;
 | 
			
		||||
  if (level === 3) {
 | 
			
		||||
    return chalkInstance
 | 
			
		||||
      .rgb(
 | 
			
		||||
        _colors.bForeground3[0],
 | 
			
		||||
        _colors.bForeground3[1],
 | 
			
		||||
        _colors.bForeground3[2]
 | 
			
		||||
      )
 | 
			
		||||
      .bgRgb(
 | 
			
		||||
        _colors.bBackground3[0],
 | 
			
		||||
        _colors.bBackground3[1],
 | 
			
		||||
        _colors.bBackground3[2]
 | 
			
		||||
      );
 | 
			
		||||
  }
 | 
			
		||||
  if (level === 2) {
 | 
			
		||||
    return chalkInstance
 | 
			
		||||
      .ansi256(_colors.bForeground2)
 | 
			
		||||
      .bgAnsi256(_colors.bBackground2);
 | 
			
		||||
  }
 | 
			
		||||
  return chalkInstance.cyan.bgWhiteBright; // also known as teal
 | 
			
		||||
};
 | 
			
		||||
exports.getReceivedColorForChalkInstance = getReceivedColorForChalkInstance;
 | 
			
		||||
const aSnapshotColor = getSnapshotColorForChalkInstance(_chalk.default);
 | 
			
		||||
exports.aSnapshotColor = aSnapshotColor;
 | 
			
		||||
const bReceivedColor = getReceivedColorForChalkInstance(_chalk.default);
 | 
			
		||||
exports.bReceivedColor = bReceivedColor;
 | 
			
		||||
const noColor = string => string;
 | 
			
		||||
exports.noColor = noColor;
 | 
			
		||||
const HINT_ARG = 'hint';
 | 
			
		||||
exports.HINT_ARG = HINT_ARG;
 | 
			
		||||
const SNAPSHOT_ARG = 'snapshot';
 | 
			
		||||
exports.SNAPSHOT_ARG = SNAPSHOT_ARG;
 | 
			
		||||
const PROPERTIES_ARG = 'properties';
 | 
			
		||||
exports.PROPERTIES_ARG = PROPERTIES_ARG;
 | 
			
		||||
const matcherHintFromConfig = (
 | 
			
		||||
  {context: {isNot, promise}, hint, inlineSnapshot, matcherName, properties},
 | 
			
		||||
  isUpdatable
 | 
			
		||||
) => {
 | 
			
		||||
  const options = {
 | 
			
		||||
    isNot,
 | 
			
		||||
    promise
 | 
			
		||||
  };
 | 
			
		||||
  if (isUpdatable) {
 | 
			
		||||
    options.receivedColor = bReceivedColor;
 | 
			
		||||
  }
 | 
			
		||||
  let expectedArgument = '';
 | 
			
		||||
  if (typeof properties === 'object') {
 | 
			
		||||
    expectedArgument = PROPERTIES_ARG;
 | 
			
		||||
    if (isUpdatable) {
 | 
			
		||||
      options.expectedColor = noColor;
 | 
			
		||||
    }
 | 
			
		||||
    if (typeof hint === 'string' && hint.length !== 0) {
 | 
			
		||||
      options.secondArgument = HINT_ARG;
 | 
			
		||||
      options.secondArgumentColor = _jestMatcherUtils.BOLD_WEIGHT;
 | 
			
		||||
    } else if (typeof inlineSnapshot === 'string') {
 | 
			
		||||
      options.secondArgument = SNAPSHOT_ARG;
 | 
			
		||||
      if (isUpdatable) {
 | 
			
		||||
        options.secondArgumentColor = aSnapshotColor;
 | 
			
		||||
      } else {
 | 
			
		||||
        options.secondArgumentColor = noColor;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    if (typeof hint === 'string' && hint.length !== 0) {
 | 
			
		||||
      expectedArgument = HINT_ARG;
 | 
			
		||||
      options.expectedColor = _jestMatcherUtils.BOLD_WEIGHT;
 | 
			
		||||
    } else if (typeof inlineSnapshot === 'string') {
 | 
			
		||||
      expectedArgument = SNAPSHOT_ARG;
 | 
			
		||||
      if (isUpdatable) {
 | 
			
		||||
        options.expectedColor = aSnapshotColor;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return (0, _jestMatcherUtils.matcherHint)(
 | 
			
		||||
    matcherName,
 | 
			
		||||
    undefined,
 | 
			
		||||
    expectedArgument,
 | 
			
		||||
    options
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Given array of diffs, return string:
 | 
			
		||||
// * include common substrings
 | 
			
		||||
// * exclude change substrings which have opposite op
 | 
			
		||||
// * include change substrings which have argument op
 | 
			
		||||
//   with change color only if there is a common substring
 | 
			
		||||
exports.matcherHintFromConfig = matcherHintFromConfig;
 | 
			
		||||
const joinDiffs = (diffs, op, hasCommon) =>
 | 
			
		||||
  diffs.reduce(
 | 
			
		||||
    (reduced, diff) =>
 | 
			
		||||
      reduced +
 | 
			
		||||
      (diff[0] === _jestDiff.DIFF_EQUAL
 | 
			
		||||
        ? diff[1]
 | 
			
		||||
        : diff[0] !== op
 | 
			
		||||
        ? ''
 | 
			
		||||
        : hasCommon
 | 
			
		||||
        ? (0, _jestMatcherUtils.INVERTED_COLOR)(diff[1])
 | 
			
		||||
        : diff[1]),
 | 
			
		||||
    ''
 | 
			
		||||
  );
 | 
			
		||||
const isLineDiffable = received => {
 | 
			
		||||
  const receivedType = (0, _jestGetType.getType)(received);
 | 
			
		||||
  if ((0, _jestGetType.isPrimitive)(received)) {
 | 
			
		||||
    return typeof received === 'string';
 | 
			
		||||
  }
 | 
			
		||||
  if (
 | 
			
		||||
    receivedType === 'date' ||
 | 
			
		||||
    receivedType === 'function' ||
 | 
			
		||||
    receivedType === 'regexp'
 | 
			
		||||
  ) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  if (received instanceof Error) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  if (
 | 
			
		||||
    receivedType === 'object' &&
 | 
			
		||||
    typeof received.asymmetricMatch === 'function'
 | 
			
		||||
  ) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  return true;
 | 
			
		||||
};
 | 
			
		||||
const printExpected = val =>
 | 
			
		||||
  (0, _jestMatcherUtils.EXPECTED_COLOR)((0, _utils.minify)(val));
 | 
			
		||||
exports.printExpected = printExpected;
 | 
			
		||||
const printReceived = val =>
 | 
			
		||||
  (0, _jestMatcherUtils.RECEIVED_COLOR)((0, _utils.minify)(val));
 | 
			
		||||
exports.printReceived = printReceived;
 | 
			
		||||
const printPropertiesAndReceived = (
 | 
			
		||||
  properties,
 | 
			
		||||
  received,
 | 
			
		||||
  expand // CLI options: true if `--expand` or false if `--no-expand`
 | 
			
		||||
) => {
 | 
			
		||||
  const aAnnotation = 'Expected properties';
 | 
			
		||||
  const bAnnotation = 'Received value';
 | 
			
		||||
  if (isLineDiffable(properties) && isLineDiffable(received)) {
 | 
			
		||||
    const {replacedExpected, replacedReceived} = (0,
 | 
			
		||||
    _jestMatcherUtils.replaceMatchedToAsymmetricMatcher)(
 | 
			
		||||
      properties,
 | 
			
		||||
      received,
 | 
			
		||||
      [],
 | 
			
		||||
      []
 | 
			
		||||
    );
 | 
			
		||||
    return (0, _jestDiff.diffLinesUnified)(
 | 
			
		||||
      (0, _utils.serialize)(replacedExpected).split('\n'),
 | 
			
		||||
      (0, _utils.serialize)(
 | 
			
		||||
        (0, _expectUtils.getObjectSubset)(replacedReceived, replacedExpected)
 | 
			
		||||
      ).split('\n'),
 | 
			
		||||
      {
 | 
			
		||||
        aAnnotation,
 | 
			
		||||
        aColor: _jestMatcherUtils.EXPECTED_COLOR,
 | 
			
		||||
        bAnnotation,
 | 
			
		||||
        bColor: _jestMatcherUtils.RECEIVED_COLOR,
 | 
			
		||||
        changeLineTrailingSpaceColor: _chalk.default.bgYellow,
 | 
			
		||||
        commonLineTrailingSpaceColor: _chalk.default.bgYellow,
 | 
			
		||||
        emptyFirstOrLastLinePlaceholder: '↵',
 | 
			
		||||
        // U+21B5
 | 
			
		||||
        expand,
 | 
			
		||||
        includeChangeCounts: true
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
 | 
			
		||||
    aAnnotation,
 | 
			
		||||
    bAnnotation
 | 
			
		||||
  );
 | 
			
		||||
  return `${printLabel(aAnnotation) + printExpected(properties)}\n${printLabel(
 | 
			
		||||
    bAnnotation
 | 
			
		||||
  )}${printReceived(received)}`;
 | 
			
		||||
};
 | 
			
		||||
exports.printPropertiesAndReceived = printPropertiesAndReceived;
 | 
			
		||||
const MAX_DIFF_STRING_LENGTH = 20000;
 | 
			
		||||
const printSnapshotAndReceived = (a, b, received, expand, snapshotFormat) => {
 | 
			
		||||
  const aAnnotation = 'Snapshot';
 | 
			
		||||
  const bAnnotation = 'Received';
 | 
			
		||||
  const aColor = aSnapshotColor;
 | 
			
		||||
  const bColor = bReceivedColor;
 | 
			
		||||
  const options = {
 | 
			
		||||
    aAnnotation,
 | 
			
		||||
    aColor,
 | 
			
		||||
    bAnnotation,
 | 
			
		||||
    bColor,
 | 
			
		||||
    changeLineTrailingSpaceColor: noColor,
 | 
			
		||||
    commonLineTrailingSpaceColor: _chalk.default.bgYellow,
 | 
			
		||||
    emptyFirstOrLastLinePlaceholder: '↵',
 | 
			
		||||
    // U+21B5
 | 
			
		||||
    expand,
 | 
			
		||||
    includeChangeCounts: true
 | 
			
		||||
  };
 | 
			
		||||
  if (typeof received === 'string') {
 | 
			
		||||
    if (
 | 
			
		||||
      a.length >= 2 &&
 | 
			
		||||
      a.startsWith('"') &&
 | 
			
		||||
      a.endsWith('"') &&
 | 
			
		||||
      b === (0, _prettyFormat.format)(received)
 | 
			
		||||
    ) {
 | 
			
		||||
      // If snapshot looks like default serialization of a string
 | 
			
		||||
      // and received is string which has default serialization.
 | 
			
		||||
 | 
			
		||||
      if (!a.includes('\n') && !b.includes('\n')) {
 | 
			
		||||
        // If neither string is multiline,
 | 
			
		||||
        // display as labels and quoted strings.
 | 
			
		||||
        let aQuoted = a;
 | 
			
		||||
        let bQuoted = b;
 | 
			
		||||
        if (
 | 
			
		||||
          a.length - 2 <= MAX_DIFF_STRING_LENGTH &&
 | 
			
		||||
          b.length - 2 <= MAX_DIFF_STRING_LENGTH
 | 
			
		||||
        ) {
 | 
			
		||||
          const diffs = (0, _jestDiff.diffStringsRaw)(
 | 
			
		||||
            a.slice(1, -1),
 | 
			
		||||
            b.slice(1, -1),
 | 
			
		||||
            true
 | 
			
		||||
          );
 | 
			
		||||
          const hasCommon = diffs.some(
 | 
			
		||||
            diff => diff[0] === _jestDiff.DIFF_EQUAL
 | 
			
		||||
          );
 | 
			
		||||
          aQuoted = `"${joinDiffs(diffs, _jestDiff.DIFF_DELETE, hasCommon)}"`;
 | 
			
		||||
          bQuoted = `"${joinDiffs(diffs, _jestDiff.DIFF_INSERT, hasCommon)}"`;
 | 
			
		||||
        }
 | 
			
		||||
        const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
 | 
			
		||||
          aAnnotation,
 | 
			
		||||
          bAnnotation
 | 
			
		||||
        );
 | 
			
		||||
        return `${printLabel(aAnnotation) + aColor(aQuoted)}\n${printLabel(
 | 
			
		||||
          bAnnotation
 | 
			
		||||
        )}${bColor(bQuoted)}`;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Else either string is multiline, so display as unquoted strings.
 | 
			
		||||
      a = (0, _utils.deserializeString)(a); //  hypothetical expected string
 | 
			
		||||
      b = received; // not serialized
 | 
			
		||||
    }
 | 
			
		||||
    // Else expected had custom serialization or was not a string
 | 
			
		||||
    // or received has custom serialization.
 | 
			
		||||
 | 
			
		||||
    return a.length <= MAX_DIFF_STRING_LENGTH &&
 | 
			
		||||
      b.length <= MAX_DIFF_STRING_LENGTH
 | 
			
		||||
      ? (0, _jestDiff.diffStringsUnified)(a, b, options)
 | 
			
		||||
      : (0, _jestDiff.diffLinesUnified)(a.split('\n'), b.split('\n'), options);
 | 
			
		||||
  }
 | 
			
		||||
  if (isLineDiffable(received)) {
 | 
			
		||||
    const aLines2 = a.split('\n');
 | 
			
		||||
    const bLines2 = b.split('\n');
 | 
			
		||||
 | 
			
		||||
    // Fall through to fix a regression for custom serializers
 | 
			
		||||
    // like jest-snapshot-serializer-raw that ignore the indent option.
 | 
			
		||||
    const b0 = (0, _utils.serialize)(received, 0, snapshotFormat);
 | 
			
		||||
    if (b0 !== b) {
 | 
			
		||||
      const aLines0 = (0, _dedentLines.dedentLines)(aLines2);
 | 
			
		||||
      if (aLines0 !== null) {
 | 
			
		||||
        // Compare lines without indentation.
 | 
			
		||||
        const bLines0 = b0.split('\n');
 | 
			
		||||
        return (0, _jestDiff.diffLinesUnified2)(
 | 
			
		||||
          aLines2,
 | 
			
		||||
          bLines2,
 | 
			
		||||
          aLines0,
 | 
			
		||||
          bLines0,
 | 
			
		||||
          options
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Fall back because:
 | 
			
		||||
    // * props include a multiline string
 | 
			
		||||
    // * text has more than one adjacent line
 | 
			
		||||
    // * markup does not close
 | 
			
		||||
    return (0, _jestDiff.diffLinesUnified)(aLines2, bLines2, options);
 | 
			
		||||
  }
 | 
			
		||||
  const printLabel = (0, _jestMatcherUtils.getLabelPrinter)(
 | 
			
		||||
    aAnnotation,
 | 
			
		||||
    bAnnotation
 | 
			
		||||
  );
 | 
			
		||||
  return `${printLabel(aAnnotation) + aColor(a)}\n${printLabel(
 | 
			
		||||
    bAnnotation
 | 
			
		||||
  )}${bColor(b)}`;
 | 
			
		||||
};
 | 
			
		||||
exports.printSnapshotAndReceived = printSnapshotAndReceived;
 | 
			
		||||
							
								
								
									
										1
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
							
								
								
									
										320
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										320
									
								
								qwen/nodejs/node_modules/jest-snapshot/build/utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,320 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, '__esModule', {
 | 
			
		||||
  value: true
 | 
			
		||||
});
 | 
			
		||||
exports.testNameToKey =
 | 
			
		||||
  exports.serialize =
 | 
			
		||||
  exports.saveSnapshotFile =
 | 
			
		||||
  exports.removeLinesBeforeExternalMatcherTrap =
 | 
			
		||||
  exports.removeExtraLineBreaks =
 | 
			
		||||
  exports.minify =
 | 
			
		||||
  exports.keyToTestName =
 | 
			
		||||
  exports.getSnapshotData =
 | 
			
		||||
  exports.escapeBacktickString =
 | 
			
		||||
  exports.ensureDirectoryExists =
 | 
			
		||||
  exports.deserializeString =
 | 
			
		||||
  exports.deepMerge =
 | 
			
		||||
  exports.addExtraLineBreaks =
 | 
			
		||||
  exports.SNAPSHOT_VERSION_WARNING =
 | 
			
		||||
  exports.SNAPSHOT_VERSION =
 | 
			
		||||
  exports.SNAPSHOT_GUIDE_LINK =
 | 
			
		||||
    void 0;
 | 
			
		||||
var path = _interopRequireWildcard(require('path'));
 | 
			
		||||
var _chalk = _interopRequireDefault(require('chalk'));
 | 
			
		||||
var fs = _interopRequireWildcard(require('graceful-fs'));
 | 
			
		||||
var _naturalCompare = _interopRequireDefault(require('natural-compare'));
 | 
			
		||||
var _prettyFormat = require('pretty-format');
 | 
			
		||||
var _plugins = require('./plugins');
 | 
			
		||||
function _interopRequireDefault(obj) {
 | 
			
		||||
  return obj && obj.__esModule ? obj : {default: obj};
 | 
			
		||||
}
 | 
			
		||||
function _getRequireWildcardCache(nodeInterop) {
 | 
			
		||||
  if (typeof WeakMap !== 'function') return null;
 | 
			
		||||
  var cacheBabelInterop = new WeakMap();
 | 
			
		||||
  var cacheNodeInterop = new WeakMap();
 | 
			
		||||
  return (_getRequireWildcardCache = function (nodeInterop) {
 | 
			
		||||
    return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
 | 
			
		||||
  })(nodeInterop);
 | 
			
		||||
}
 | 
			
		||||
function _interopRequireWildcard(obj, nodeInterop) {
 | 
			
		||||
  if (!nodeInterop && obj && obj.__esModule) {
 | 
			
		||||
    return obj;
 | 
			
		||||
  }
 | 
			
		||||
  if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
 | 
			
		||||
    return {default: obj};
 | 
			
		||||
  }
 | 
			
		||||
  var cache = _getRequireWildcardCache(nodeInterop);
 | 
			
		||||
  if (cache && cache.has(obj)) {
 | 
			
		||||
    return cache.get(obj);
 | 
			
		||||
  }
 | 
			
		||||
  var newObj = {};
 | 
			
		||||
  var hasPropertyDescriptor =
 | 
			
		||||
    Object.defineProperty && Object.getOwnPropertyDescriptor;
 | 
			
		||||
  for (var key in obj) {
 | 
			
		||||
    if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
 | 
			
		||||
      var desc = hasPropertyDescriptor
 | 
			
		||||
        ? Object.getOwnPropertyDescriptor(obj, key)
 | 
			
		||||
        : null;
 | 
			
		||||
      if (desc && (desc.get || desc.set)) {
 | 
			
		||||
        Object.defineProperty(newObj, key, desc);
 | 
			
		||||
      } else {
 | 
			
		||||
        newObj[key] = obj[key];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  newObj.default = obj;
 | 
			
		||||
  if (cache) {
 | 
			
		||||
    cache.set(obj, newObj);
 | 
			
		||||
  }
 | 
			
		||||
  return newObj;
 | 
			
		||||
}
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestWriteFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-write-file')] || fs.writeFileSync;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestReadFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-read-file')] || fs.readFileSync;
 | 
			
		||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
 | 
			
		||||
var jestExistsFile =
 | 
			
		||||
  globalThis[Symbol.for('jest-native-exists-file')] || fs.existsSync;
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 | 
			
		||||
 *
 | 
			
		||||
 * This source code is licensed under the MIT license found in the
 | 
			
		||||
 * LICENSE file in the root directory of this source tree.
 | 
			
		||||
 */
 | 
			
		||||
const SNAPSHOT_VERSION = '1';
 | 
			
		||||
exports.SNAPSHOT_VERSION = SNAPSHOT_VERSION;
 | 
			
		||||
const SNAPSHOT_VERSION_REGEXP = /^\/\/ Jest Snapshot v(.+),/;
 | 
			
		||||
const SNAPSHOT_GUIDE_LINK = 'https://goo.gl/fbAQLP';
 | 
			
		||||
exports.SNAPSHOT_GUIDE_LINK = SNAPSHOT_GUIDE_LINK;
 | 
			
		||||
const SNAPSHOT_VERSION_WARNING = _chalk.default.yellow(
 | 
			
		||||
  `${_chalk.default.bold('Warning')}: Before you upgrade snapshots, ` +
 | 
			
		||||
    'we recommend that you revert any local changes to tests or other code, ' +
 | 
			
		||||
    'to ensure that you do not store invalid state.'
 | 
			
		||||
);
 | 
			
		||||
exports.SNAPSHOT_VERSION_WARNING = SNAPSHOT_VERSION_WARNING;
 | 
			
		||||
const writeSnapshotVersion = () =>
 | 
			
		||||
  `// Jest Snapshot v${SNAPSHOT_VERSION}, ${SNAPSHOT_GUIDE_LINK}`;
 | 
			
		||||
const validateSnapshotVersion = snapshotContents => {
 | 
			
		||||
  const versionTest = SNAPSHOT_VERSION_REGEXP.exec(snapshotContents);
 | 
			
		||||
  const version = versionTest && versionTest[1];
 | 
			
		||||
  if (!version) {
 | 
			
		||||
    return new Error(
 | 
			
		||||
      _chalk.default.red(
 | 
			
		||||
        `${_chalk.default.bold(
 | 
			
		||||
          'Outdated snapshot'
 | 
			
		||||
        )}: No snapshot header found. ` +
 | 
			
		||||
          'Jest 19 introduced versioned snapshots to ensure all developers ' +
 | 
			
		||||
          'on a project are using the same version of Jest. ' +
 | 
			
		||||
          'Please update all snapshots during this upgrade of Jest.\n\n'
 | 
			
		||||
      ) + SNAPSHOT_VERSION_WARNING
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  if (version < SNAPSHOT_VERSION) {
 | 
			
		||||
    return new Error(
 | 
			
		||||
      // eslint-disable-next-line prefer-template
 | 
			
		||||
      _chalk.default.red(
 | 
			
		||||
        `${_chalk.default.red.bold(
 | 
			
		||||
          'Outdated snapshot'
 | 
			
		||||
        )}: The version of the snapshot ` +
 | 
			
		||||
          'file associated with this test is outdated. The snapshot file ' +
 | 
			
		||||
          'version ensures that all developers on a project are using ' +
 | 
			
		||||
          'the same version of Jest. ' +
 | 
			
		||||
          'Please update all snapshots during this upgrade of Jest.'
 | 
			
		||||
      ) +
 | 
			
		||||
        '\n\n' +
 | 
			
		||||
        `Expected: v${SNAPSHOT_VERSION}\n` +
 | 
			
		||||
        `Received: v${version}\n\n` +
 | 
			
		||||
        SNAPSHOT_VERSION_WARNING
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  if (version > SNAPSHOT_VERSION) {
 | 
			
		||||
    return new Error(
 | 
			
		||||
      // eslint-disable-next-line prefer-template
 | 
			
		||||
      _chalk.default.red(
 | 
			
		||||
        `${_chalk.default.red.bold(
 | 
			
		||||
          'Outdated Jest version'
 | 
			
		||||
        )}: The version of this ` +
 | 
			
		||||
          'snapshot file indicates that this project is meant to be used ' +
 | 
			
		||||
          'with a newer version of Jest. The snapshot file version ensures ' +
 | 
			
		||||
          'that all developers on a project are using the same version of ' +
 | 
			
		||||
          'Jest. Please update your version of Jest and re-run the tests.'
 | 
			
		||||
      ) +
 | 
			
		||||
        '\n\n' +
 | 
			
		||||
        `Expected: v${SNAPSHOT_VERSION}\n` +
 | 
			
		||||
        `Received: v${version}`
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  return null;
 | 
			
		||||
};
 | 
			
		||||
function isObject(item) {
 | 
			
		||||
  return item != null && typeof item === 'object' && !Array.isArray(item);
 | 
			
		||||
}
 | 
			
		||||
const testNameToKey = (testName, count) => `${testName} ${count}`;
 | 
			
		||||
exports.testNameToKey = testNameToKey;
 | 
			
		||||
const keyToTestName = key => {
 | 
			
		||||
  if (!/ \d+$/.test(key)) {
 | 
			
		||||
    throw new Error('Snapshot keys must end with a number.');
 | 
			
		||||
  }
 | 
			
		||||
  return key.replace(/ \d+$/, '');
 | 
			
		||||
};
 | 
			
		||||
exports.keyToTestName = keyToTestName;
 | 
			
		||||
const getSnapshotData = (snapshotPath, update) => {
 | 
			
		||||
  const data = Object.create(null);
 | 
			
		||||
  let snapshotContents = '';
 | 
			
		||||
  let dirty = false;
 | 
			
		||||
  if (jestExistsFile(snapshotPath)) {
 | 
			
		||||
    try {
 | 
			
		||||
      snapshotContents = jestReadFile(snapshotPath, 'utf8');
 | 
			
		||||
      // eslint-disable-next-line no-new-func
 | 
			
		||||
      const populate = new Function('exports', snapshotContents);
 | 
			
		||||
      populate(data);
 | 
			
		||||
    } catch {}
 | 
			
		||||
  }
 | 
			
		||||
  const validationResult = validateSnapshotVersion(snapshotContents);
 | 
			
		||||
  const isInvalid = snapshotContents && validationResult;
 | 
			
		||||
  if (update === 'none' && isInvalid) {
 | 
			
		||||
    throw validationResult;
 | 
			
		||||
  }
 | 
			
		||||
  if ((update === 'all' || update === 'new') && isInvalid) {
 | 
			
		||||
    dirty = true;
 | 
			
		||||
  }
 | 
			
		||||
  return {
 | 
			
		||||
    data,
 | 
			
		||||
    dirty
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Add extra line breaks at beginning and end of multiline snapshot
 | 
			
		||||
// to make the content easier to read.
 | 
			
		||||
exports.getSnapshotData = getSnapshotData;
 | 
			
		||||
const addExtraLineBreaks = string =>
 | 
			
		||||
  string.includes('\n') ? `\n${string}\n` : string;
 | 
			
		||||
 | 
			
		||||
// Remove extra line breaks at beginning and end of multiline snapshot.
 | 
			
		||||
// Instead of trim, which can remove additional newlines or spaces
 | 
			
		||||
// at beginning or end of the content from a custom serializer.
 | 
			
		||||
exports.addExtraLineBreaks = addExtraLineBreaks;
 | 
			
		||||
const removeExtraLineBreaks = string =>
 | 
			
		||||
  string.length > 2 && string.startsWith('\n') && string.endsWith('\n')
 | 
			
		||||
    ? string.slice(1, -1)
 | 
			
		||||
    : string;
 | 
			
		||||
exports.removeExtraLineBreaks = removeExtraLineBreaks;
 | 
			
		||||
const removeLinesBeforeExternalMatcherTrap = stack => {
 | 
			
		||||
  const lines = stack.split('\n');
 | 
			
		||||
  for (let i = 0; i < lines.length; i += 1) {
 | 
			
		||||
    // It's a function name specified in `packages/expect/src/index.ts`
 | 
			
		||||
    // for external custom matchers.
 | 
			
		||||
    if (lines[i].includes('__EXTERNAL_MATCHER_TRAP__')) {
 | 
			
		||||
      return lines.slice(i + 1).join('\n');
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return stack;
 | 
			
		||||
};
 | 
			
		||||
exports.removeLinesBeforeExternalMatcherTrap =
 | 
			
		||||
  removeLinesBeforeExternalMatcherTrap;
 | 
			
		||||
const escapeRegex = true;
 | 
			
		||||
const printFunctionName = false;
 | 
			
		||||
const serialize = (val, indent = 2, formatOverrides = {}) =>
 | 
			
		||||
  normalizeNewlines(
 | 
			
		||||
    (0, _prettyFormat.format)(val, {
 | 
			
		||||
      escapeRegex,
 | 
			
		||||
      indent,
 | 
			
		||||
      plugins: (0, _plugins.getSerializers)(),
 | 
			
		||||
      printFunctionName,
 | 
			
		||||
      ...formatOverrides
 | 
			
		||||
    })
 | 
			
		||||
  );
 | 
			
		||||
exports.serialize = serialize;
 | 
			
		||||
const minify = val =>
 | 
			
		||||
  (0, _prettyFormat.format)(val, {
 | 
			
		||||
    escapeRegex,
 | 
			
		||||
    min: true,
 | 
			
		||||
    plugins: (0, _plugins.getSerializers)(),
 | 
			
		||||
    printFunctionName
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
// Remove double quote marks and unescape double quotes and backslashes.
 | 
			
		||||
exports.minify = minify;
 | 
			
		||||
const deserializeString = stringified =>
 | 
			
		||||
  stringified.slice(1, -1).replace(/\\("|\\)/g, '$1');
 | 
			
		||||
exports.deserializeString = deserializeString;
 | 
			
		||||
const escapeBacktickString = str => str.replace(/`|\\|\${/g, '\\$&');
 | 
			
		||||
exports.escapeBacktickString = escapeBacktickString;
 | 
			
		||||
const printBacktickString = str => `\`${escapeBacktickString(str)}\``;
 | 
			
		||||
const ensureDirectoryExists = filePath => {
 | 
			
		||||
  try {
 | 
			
		||||
    fs.mkdirSync(path.dirname(filePath), {
 | 
			
		||||
      recursive: true
 | 
			
		||||
    });
 | 
			
		||||
  } catch {}
 | 
			
		||||
};
 | 
			
		||||
exports.ensureDirectoryExists = ensureDirectoryExists;
 | 
			
		||||
const normalizeNewlines = string => string.replace(/\r\n|\r/g, '\n');
 | 
			
		||||
const saveSnapshotFile = (snapshotData, snapshotPath) => {
 | 
			
		||||
  const snapshots = Object.keys(snapshotData)
 | 
			
		||||
    .sort(_naturalCompare.default)
 | 
			
		||||
    .map(
 | 
			
		||||
      key =>
 | 
			
		||||
        `exports[${printBacktickString(key)}] = ${printBacktickString(
 | 
			
		||||
          normalizeNewlines(snapshotData[key])
 | 
			
		||||
        )};`
 | 
			
		||||
    );
 | 
			
		||||
  ensureDirectoryExists(snapshotPath);
 | 
			
		||||
  jestWriteFile(
 | 
			
		||||
    snapshotPath,
 | 
			
		||||
    `${writeSnapshotVersion()}\n\n${snapshots.join('\n\n')}\n`
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
exports.saveSnapshotFile = saveSnapshotFile;
 | 
			
		||||
const isAnyOrAnything = input =>
 | 
			
		||||
  '$$typeof' in input &&
 | 
			
		||||
  input.$$typeof === Symbol.for('jest.asymmetricMatcher') &&
 | 
			
		||||
  ['Any', 'Anything'].includes(input.constructor.name);
 | 
			
		||||
const deepMergeArray = (target, source) => {
 | 
			
		||||
  const mergedOutput = Array.from(target);
 | 
			
		||||
  source.forEach((sourceElement, index) => {
 | 
			
		||||
    const targetElement = mergedOutput[index];
 | 
			
		||||
    if (Array.isArray(target[index]) && Array.isArray(sourceElement)) {
 | 
			
		||||
      mergedOutput[index] = deepMergeArray(target[index], sourceElement);
 | 
			
		||||
    } else if (isObject(targetElement) && !isAnyOrAnything(sourceElement)) {
 | 
			
		||||
      mergedOutput[index] = deepMerge(target[index], sourceElement);
 | 
			
		||||
    } else {
 | 
			
		||||
      // Source does not exist in target or target is primitive and cannot be deep merged
 | 
			
		||||
      mergedOutput[index] = sourceElement;
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  return mergedOutput;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
 | 
			
		||||
const deepMerge = (target, source) => {
 | 
			
		||||
  if (isObject(target) && isObject(source)) {
 | 
			
		||||
    const mergedOutput = {
 | 
			
		||||
      ...target
 | 
			
		||||
    };
 | 
			
		||||
    Object.keys(source).forEach(key => {
 | 
			
		||||
      if (isObject(source[key]) && !source[key].$$typeof) {
 | 
			
		||||
        if (!(key in target))
 | 
			
		||||
          Object.assign(mergedOutput, {
 | 
			
		||||
            [key]: source[key]
 | 
			
		||||
          });
 | 
			
		||||
        else mergedOutput[key] = deepMerge(target[key], source[key]);
 | 
			
		||||
      } else if (Array.isArray(source[key])) {
 | 
			
		||||
        mergedOutput[key] = deepMergeArray(target[key], source[key]);
 | 
			
		||||
      } else {
 | 
			
		||||
        Object.assign(mergedOutput, {
 | 
			
		||||
          [key]: source[key]
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    return mergedOutput;
 | 
			
		||||
  } else if (Array.isArray(target) && Array.isArray(source)) {
 | 
			
		||||
    return deepMergeArray(target, source);
 | 
			
		||||
  }
 | 
			
		||||
  return target;
 | 
			
		||||
};
 | 
			
		||||
exports.deepMerge = deepMerge;
 | 
			
		||||
							
								
								
									
										1
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/.bin/semver
									
									
									
										generated
									
									
										vendored
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/.bin/semver
									
									
									
										generated
									
									
										vendored
									
									
										Symbolic link
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
../semver/bin/semver.js
 | 
			
		||||
							
								
								
									
										15
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
The ISC License
 | 
			
		||||
 | 
			
		||||
Copyright (c) Isaac Z. Schlueter and Contributors
 | 
			
		||||
 | 
			
		||||
Permission to use, copy, modify, and/or distribute this software for any
 | 
			
		||||
purpose with or without fee is hereby granted, provided that the above
 | 
			
		||||
copyright notice and this permission notice appear in all copies.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
			
		||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
			
		||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
			
		||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
			
		||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
			
		||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
 | 
			
		||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
							
								
								
									
										664
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										664
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,664 @@
 | 
			
		||||
semver(1) -- The semantic versioner for npm
 | 
			
		||||
===========================================
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npm install semver
 | 
			
		||||
````
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
As a node module:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const semver = require('semver')
 | 
			
		||||
 | 
			
		||||
semver.valid('1.2.3') // '1.2.3'
 | 
			
		||||
semver.valid('a.b.c') // null
 | 
			
		||||
semver.clean('  =v1.2.3   ') // '1.2.3'
 | 
			
		||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
 | 
			
		||||
semver.gt('1.2.3', '9.8.7') // false
 | 
			
		||||
semver.lt('1.2.3', '9.8.7') // true
 | 
			
		||||
semver.minVersion('>=1.0.0') // '1.0.0'
 | 
			
		||||
semver.valid(semver.coerce('v2')) // '2.0.0'
 | 
			
		||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You can also just load the module for the function that you care about if
 | 
			
		||||
you'd like to minimize your footprint.
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
// load the whole API at once in a single object
 | 
			
		||||
const semver = require('semver')
 | 
			
		||||
 | 
			
		||||
// or just load the bits you need
 | 
			
		||||
// all of them listed here, just pick and choose what you want
 | 
			
		||||
 | 
			
		||||
// classes
 | 
			
		||||
const SemVer = require('semver/classes/semver')
 | 
			
		||||
const Comparator = require('semver/classes/comparator')
 | 
			
		||||
const Range = require('semver/classes/range')
 | 
			
		||||
 | 
			
		||||
// functions for working with versions
 | 
			
		||||
const semverParse = require('semver/functions/parse')
 | 
			
		||||
const semverValid = require('semver/functions/valid')
 | 
			
		||||
const semverClean = require('semver/functions/clean')
 | 
			
		||||
const semverInc = require('semver/functions/inc')
 | 
			
		||||
const semverDiff = require('semver/functions/diff')
 | 
			
		||||
const semverMajor = require('semver/functions/major')
 | 
			
		||||
const semverMinor = require('semver/functions/minor')
 | 
			
		||||
const semverPatch = require('semver/functions/patch')
 | 
			
		||||
const semverPrerelease = require('semver/functions/prerelease')
 | 
			
		||||
const semverCompare = require('semver/functions/compare')
 | 
			
		||||
const semverRcompare = require('semver/functions/rcompare')
 | 
			
		||||
const semverCompareLoose = require('semver/functions/compare-loose')
 | 
			
		||||
const semverCompareBuild = require('semver/functions/compare-build')
 | 
			
		||||
const semverSort = require('semver/functions/sort')
 | 
			
		||||
const semverRsort = require('semver/functions/rsort')
 | 
			
		||||
 | 
			
		||||
// low-level comparators between versions
 | 
			
		||||
const semverGt = require('semver/functions/gt')
 | 
			
		||||
const semverLt = require('semver/functions/lt')
 | 
			
		||||
const semverEq = require('semver/functions/eq')
 | 
			
		||||
const semverNeq = require('semver/functions/neq')
 | 
			
		||||
const semverGte = require('semver/functions/gte')
 | 
			
		||||
const semverLte = require('semver/functions/lte')
 | 
			
		||||
const semverCmp = require('semver/functions/cmp')
 | 
			
		||||
const semverCoerce = require('semver/functions/coerce')
 | 
			
		||||
 | 
			
		||||
// working with ranges
 | 
			
		||||
const semverSatisfies = require('semver/functions/satisfies')
 | 
			
		||||
const semverMaxSatisfying = require('semver/ranges/max-satisfying')
 | 
			
		||||
const semverMinSatisfying = require('semver/ranges/min-satisfying')
 | 
			
		||||
const semverToComparators = require('semver/ranges/to-comparators')
 | 
			
		||||
const semverMinVersion = require('semver/ranges/min-version')
 | 
			
		||||
const semverValidRange = require('semver/ranges/valid')
 | 
			
		||||
const semverOutside = require('semver/ranges/outside')
 | 
			
		||||
const semverGtr = require('semver/ranges/gtr')
 | 
			
		||||
const semverLtr = require('semver/ranges/ltr')
 | 
			
		||||
const semverIntersects = require('semver/ranges/intersects')
 | 
			
		||||
const semverSimplifyRange = require('semver/ranges/simplify')
 | 
			
		||||
const semverRangeSubset = require('semver/ranges/subset')
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
As a command-line utility:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ semver -h
 | 
			
		||||
 | 
			
		||||
A JavaScript implementation of the https://semver.org/ specification
 | 
			
		||||
Copyright Isaac Z. Schlueter
 | 
			
		||||
 | 
			
		||||
Usage: semver [options] <version> [<version> [...]]
 | 
			
		||||
Prints valid versions sorted by SemVer precedence
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
-r --range <range>
 | 
			
		||||
        Print versions that match the specified range.
 | 
			
		||||
 | 
			
		||||
-i --increment [<level>]
 | 
			
		||||
        Increment a version by the specified level.  Level can
 | 
			
		||||
        be one of: major, minor, patch, premajor, preminor,
 | 
			
		||||
        prepatch, prerelease, or release.  Default level is 'patch'.
 | 
			
		||||
        Only one version may be specified.
 | 
			
		||||
 | 
			
		||||
--preid <identifier>
 | 
			
		||||
        Identifier to be used to prefix premajor, preminor,
 | 
			
		||||
        prepatch or prerelease version increments.
 | 
			
		||||
 | 
			
		||||
-l --loose
 | 
			
		||||
        Interpret versions and ranges loosely
 | 
			
		||||
 | 
			
		||||
-n <0|1>
 | 
			
		||||
        This is the base to be used for the prerelease identifier.
 | 
			
		||||
 | 
			
		||||
-p --include-prerelease
 | 
			
		||||
        Always include prerelease versions in range matching
 | 
			
		||||
 | 
			
		||||
-c --coerce
 | 
			
		||||
        Coerce a string into SemVer if possible
 | 
			
		||||
        (does not imply --loose)
 | 
			
		||||
 | 
			
		||||
--rtl
 | 
			
		||||
        Coerce version strings right to left
 | 
			
		||||
 | 
			
		||||
--ltr
 | 
			
		||||
        Coerce version strings left to right (default)
 | 
			
		||||
 | 
			
		||||
Program exits successfully if any valid version satisfies
 | 
			
		||||
all supplied ranges, and prints all satisfying versions.
 | 
			
		||||
 | 
			
		||||
If no satisfying versions are found, then exits failure.
 | 
			
		||||
 | 
			
		||||
Versions are printed in ascending order, so supplying
 | 
			
		||||
multiple versions to the utility will just sort them.
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Versions
 | 
			
		||||
 | 
			
		||||
A "version" is described by the `v2.0.0` specification found at
 | 
			
		||||
<https://semver.org/>.
 | 
			
		||||
 | 
			
		||||
A leading `"="` or `"v"` character is stripped off and ignored.
 | 
			
		||||
Support for stripping a leading "v" is kept for compatibility with `v1.0.0` of the SemVer
 | 
			
		||||
specification but should not be used anymore.
 | 
			
		||||
 | 
			
		||||
## Ranges
 | 
			
		||||
 | 
			
		||||
A `version range` is a set of `comparators` that specify versions
 | 
			
		||||
that satisfy the range.
 | 
			
		||||
 | 
			
		||||
A `comparator` is composed of an `operator` and a `version`.  The set
 | 
			
		||||
of primitive `operators` is:
 | 
			
		||||
 | 
			
		||||
* `<` Less than
 | 
			
		||||
* `<=` Less than or equal to
 | 
			
		||||
* `>` Greater than
 | 
			
		||||
* `>=` Greater than or equal to
 | 
			
		||||
* `=` Equal.  If no operator is specified, then equality is assumed,
 | 
			
		||||
  so this operator is optional but MAY be included.
 | 
			
		||||
 | 
			
		||||
For example, the comparator `>=1.2.7` would match the versions
 | 
			
		||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
 | 
			
		||||
or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and
 | 
			
		||||
would match the versions `2.0.0` and `3.1.0`, but not the versions
 | 
			
		||||
`1.0.1` or `1.1.0`.
 | 
			
		||||
 | 
			
		||||
Comparators can be joined by whitespace to form a `comparator set`,
 | 
			
		||||
which is satisfied by the **intersection** of all of the comparators
 | 
			
		||||
it includes.
 | 
			
		||||
 | 
			
		||||
A range is composed of one or more comparator sets, joined by `||`.  A
 | 
			
		||||
version matches a range if and only if every comparator in at least
 | 
			
		||||
one of the `||`-separated comparator sets is satisfied by the version.
 | 
			
		||||
 | 
			
		||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
 | 
			
		||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
 | 
			
		||||
or `1.1.0`.
 | 
			
		||||
 | 
			
		||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
 | 
			
		||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
 | 
			
		||||
 | 
			
		||||
### Prerelease Tags
 | 
			
		||||
 | 
			
		||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
 | 
			
		||||
it will only be allowed to satisfy comparator sets if at least one
 | 
			
		||||
comparator with the same `[major, minor, patch]` tuple also has a
 | 
			
		||||
prerelease tag.
 | 
			
		||||
 | 
			
		||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
 | 
			
		||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
 | 
			
		||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
 | 
			
		||||
than" `1.2.3-alpha.3` according to the SemVer sort rules.  The version
 | 
			
		||||
range only accepts prerelease tags on the `1.2.3` version.
 | 
			
		||||
Version `3.4.5` *would* satisfy the range because it does not have a
 | 
			
		||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
 | 
			
		||||
 | 
			
		||||
The purpose of this behavior is twofold.  First, prerelease versions
 | 
			
		||||
frequently are updated very quickly, and contain many breaking changes
 | 
			
		||||
that are (by the author's design) not yet fit for public consumption.
 | 
			
		||||
Therefore, by default, they are excluded from range-matching
 | 
			
		||||
semantics.
 | 
			
		||||
 | 
			
		||||
Second, a user who has opted into using a prerelease version has
 | 
			
		||||
indicated the intent to use *that specific* set of
 | 
			
		||||
alpha/beta/rc versions.  By including a prerelease tag in the range,
 | 
			
		||||
the user is indicating that they are aware of the risk.  However, it
 | 
			
		||||
is still not appropriate to assume that they have opted into taking a
 | 
			
		||||
similar risk on the *next* set of prerelease versions.
 | 
			
		||||
 | 
			
		||||
Note that this behavior can be suppressed (treating all prerelease
 | 
			
		||||
versions as if they were normal versions, for range-matching)
 | 
			
		||||
by setting the `includePrerelease` flag on the options
 | 
			
		||||
object to any
 | 
			
		||||
[functions](https://github.com/npm/node-semver#functions) that do
 | 
			
		||||
range matching.
 | 
			
		||||
 | 
			
		||||
#### Prerelease Identifiers
 | 
			
		||||
 | 
			
		||||
The method `.inc` takes an additional `identifier` string argument that
 | 
			
		||||
will append the value of the string as a prerelease identifier:
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
semver.inc('1.2.3', 'prerelease', 'beta')
 | 
			
		||||
// '1.2.4-beta.0'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
command-line example:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ semver 1.2.3 -i prerelease --preid beta
 | 
			
		||||
1.2.4-beta.0
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Which then can be used to increment further:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ semver 1.2.4-beta.0 -i prerelease
 | 
			
		||||
1.2.4-beta.1
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
To get out of the prerelease phase, use the `release` option:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ semver 1.2.4-beta.1 -i release
 | 
			
		||||
1.2.4
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Prerelease Identifier Base
 | 
			
		||||
 | 
			
		||||
The method `.inc` takes an optional parameter 'identifierBase' string
 | 
			
		||||
that will let you let your prerelease number as zero-based or one-based.
 | 
			
		||||
Set to `false` to omit the prerelease number altogether.
 | 
			
		||||
If you do not specify this parameter, it will default to zero-based.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
semver.inc('1.2.3', 'prerelease', 'beta', '1')
 | 
			
		||||
// '1.2.4-beta.1'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
semver.inc('1.2.3', 'prerelease', 'beta', false)
 | 
			
		||||
// '1.2.4-beta'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
command-line example:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ semver 1.2.3 -i prerelease --preid beta -n 1
 | 
			
		||||
1.2.4-beta.1
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ semver 1.2.3 -i prerelease --preid beta -n false
 | 
			
		||||
1.2.4-beta
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Advanced Range Syntax
 | 
			
		||||
 | 
			
		||||
Advanced range syntax desugars to primitive comparators in
 | 
			
		||||
deterministic ways.
 | 
			
		||||
 | 
			
		||||
Advanced ranges may be combined in the same way as primitive
 | 
			
		||||
comparators using white space or `||`.
 | 
			
		||||
 | 
			
		||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
 | 
			
		||||
 | 
			
		||||
Specifies an inclusive set.
 | 
			
		||||
 | 
			
		||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
 | 
			
		||||
 | 
			
		||||
If a partial version is provided as the first version in the inclusive
 | 
			
		||||
range, then the missing pieces are replaced with zeroes.
 | 
			
		||||
 | 
			
		||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
 | 
			
		||||
 | 
			
		||||
If a partial version is provided as the second version in the
 | 
			
		||||
inclusive range, then all versions that start with the supplied parts
 | 
			
		||||
of the tuple are accepted, but nothing that would be greater than the
 | 
			
		||||
provided tuple parts.
 | 
			
		||||
 | 
			
		||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0`
 | 
			
		||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0`
 | 
			
		||||
 | 
			
		||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
 | 
			
		||||
 | 
			
		||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
 | 
			
		||||
numeric values in the `[major, minor, patch]` tuple.
 | 
			
		||||
 | 
			
		||||
* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
 | 
			
		||||
  `includePrerelease` is specified, in which case any version at all
 | 
			
		||||
  satisfies)
 | 
			
		||||
* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
 | 
			
		||||
* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
 | 
			
		||||
 | 
			
		||||
A partial version range is treated as an X-Range, so the special
 | 
			
		||||
character is in fact optional.
 | 
			
		||||
 | 
			
		||||
* `""` (empty string) := `*` := `>=0.0.0`
 | 
			
		||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0`
 | 
			
		||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0`
 | 
			
		||||
 | 
			
		||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
 | 
			
		||||
 | 
			
		||||
Allows patch-level changes if a minor version is specified on the
 | 
			
		||||
comparator.  Allows minor-level changes if not.
 | 
			
		||||
 | 
			
		||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0`
 | 
			
		||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
 | 
			
		||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
 | 
			
		||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
 | 
			
		||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
 | 
			
		||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
 | 
			
		||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in
 | 
			
		||||
  the `1.2.3` version will be allowed, if they are greater than or
 | 
			
		||||
  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but
 | 
			
		||||
  `1.2.4-beta.2` would not, because it is a prerelease of a
 | 
			
		||||
  different `[major, minor, patch]` tuple.
 | 
			
		||||
 | 
			
		||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
 | 
			
		||||
 | 
			
		||||
Allows changes that do not modify the left-most non-zero element in the
 | 
			
		||||
`[major, minor, patch]` tuple.  In other words, this allows patch and
 | 
			
		||||
minor updates for versions `1.0.0` and above, patch updates for
 | 
			
		||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
 | 
			
		||||
 | 
			
		||||
Many authors treat a `0.x` version as if the `x` were the major
 | 
			
		||||
"breaking-change" indicator.
 | 
			
		||||
 | 
			
		||||
Caret ranges are ideal when an author may make breaking changes
 | 
			
		||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
 | 
			
		||||
However, it presumes that there will *not* be breaking changes between
 | 
			
		||||
`0.2.4` and `0.2.5`.  It allows for changes that are presumed to be
 | 
			
		||||
additive (but non-breaking), according to commonly observed practices.
 | 
			
		||||
 | 
			
		||||
* `^1.2.3` := `>=1.2.3 <2.0.0-0`
 | 
			
		||||
* `^0.2.3` := `>=0.2.3 <0.3.0-0`
 | 
			
		||||
* `^0.0.3` := `>=0.0.3 <0.0.4-0`
 | 
			
		||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in
 | 
			
		||||
  the `1.2.3` version will be allowed, if they are greater than or
 | 
			
		||||
  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but
 | 
			
		||||
  `1.2.4-beta.2` would not, because it is a prerelease of a
 | 
			
		||||
  different `[major, minor, patch]` tuple.
 | 
			
		||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0`  Note that prereleases in the
 | 
			
		||||
  `0.0.3` version *only* will be allowed, if they are greater than or
 | 
			
		||||
  equal to `beta`.  So, `0.0.3-pr.2` would be allowed.
 | 
			
		||||
 | 
			
		||||
When parsing caret ranges, a missing `patch` value desugars to the
 | 
			
		||||
number `0`, but will allow flexibility within that value, even if the
 | 
			
		||||
major and minor versions are both `0`.
 | 
			
		||||
 | 
			
		||||
* `^1.2.x` := `>=1.2.0 <2.0.0-0`
 | 
			
		||||
* `^0.0.x` := `>=0.0.0 <0.1.0-0`
 | 
			
		||||
* `^0.0` := `>=0.0.0 <0.1.0-0`
 | 
			
		||||
 | 
			
		||||
A missing `minor` and `patch` values will desugar to zero, but also
 | 
			
		||||
allow flexibility within those values, even if the major version is
 | 
			
		||||
zero.
 | 
			
		||||
 | 
			
		||||
* `^1.x` := `>=1.0.0 <2.0.0-0`
 | 
			
		||||
* `^0.x` := `>=0.0.0 <1.0.0-0`
 | 
			
		||||
 | 
			
		||||
### Range Grammar
 | 
			
		||||
 | 
			
		||||
Putting all this together, here is a Backus-Naur grammar for ranges,
 | 
			
		||||
for the benefit of parser authors:
 | 
			
		||||
 | 
			
		||||
```bnf
 | 
			
		||||
range-set  ::= range ( logical-or range ) *
 | 
			
		||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
 | 
			
		||||
range      ::= hyphen | simple ( ' ' simple ) * | ''
 | 
			
		||||
hyphen     ::= partial ' - ' partial
 | 
			
		||||
simple     ::= primitive | partial | tilde | caret
 | 
			
		||||
primitive  ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
 | 
			
		||||
partial    ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
 | 
			
		||||
xr         ::= 'x' | 'X' | '*' | nr
 | 
			
		||||
nr         ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
 | 
			
		||||
tilde      ::= '~' partial
 | 
			
		||||
caret      ::= '^' partial
 | 
			
		||||
qualifier  ::= ( '-' pre )? ( '+' build )?
 | 
			
		||||
pre        ::= parts
 | 
			
		||||
build      ::= parts
 | 
			
		||||
parts      ::= part ( '.' part ) *
 | 
			
		||||
part       ::= nr | [-0-9A-Za-z]+
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Functions
 | 
			
		||||
 | 
			
		||||
All methods and classes take a final `options` object argument.  All
 | 
			
		||||
options in this object are `false` by default.  The options supported
 | 
			
		||||
are:
 | 
			
		||||
 | 
			
		||||
- `loose`: Be more forgiving about not-quite-valid semver strings.
 | 
			
		||||
  (Any resulting output will always be 100% strict compliant, of
 | 
			
		||||
  course.)  For backwards compatibility reasons, if the `options`
 | 
			
		||||
  argument is a boolean value instead of an object, it is interpreted
 | 
			
		||||
  to be the `loose` param.
 | 
			
		||||
- `includePrerelease`: Set to suppress the [default
 | 
			
		||||
  behavior](https://github.com/npm/node-semver#prerelease-tags) of
 | 
			
		||||
  excluding prerelease tagged versions from ranges unless they are
 | 
			
		||||
  explicitly opted into.
 | 
			
		||||
 | 
			
		||||
Strict-mode Comparators and Ranges will be strict about the SemVer
 | 
			
		||||
strings that they parse.
 | 
			
		||||
 | 
			
		||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
 | 
			
		||||
* `inc(v, releaseType, options, identifier, identifierBase)`: 
 | 
			
		||||
  Return the version incremented by the release
 | 
			
		||||
  type (`major`, `premajor`, `minor`, `preminor`, `patch`,
 | 
			
		||||
  `prepatch`, `prerelease`, or `release`), or null if it's not valid
 | 
			
		||||
  * `premajor` in one call will bump the version up to the next major
 | 
			
		||||
    version and down to a prerelease of that major version.
 | 
			
		||||
    `preminor`, and `prepatch` work the same way.
 | 
			
		||||
  * If called from a non-prerelease version, `prerelease` will work the
 | 
			
		||||
    same as `prepatch`. It increments the patch version and then makes a
 | 
			
		||||
    prerelease. If the input version is already a prerelease it simply
 | 
			
		||||
    increments it.
 | 
			
		||||
  * `release` will remove any prerelease part of the version.
 | 
			
		||||
  * `identifier` can be used to prefix `premajor`, `preminor`,
 | 
			
		||||
    `prepatch`, or `prerelease` version increments. `identifierBase`
 | 
			
		||||
    is the base to be used for the `prerelease` identifier.
 | 
			
		||||
* `prerelease(v)`: Returns an array of prerelease components, or null
 | 
			
		||||
  if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
 | 
			
		||||
* `major(v)`: Return the major version number.
 | 
			
		||||
* `minor(v)`: Return the minor version number.
 | 
			
		||||
* `patch(v)`: Return the patch version number.
 | 
			
		||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
 | 
			
		||||
  or comparators intersect.
 | 
			
		||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
 | 
			
		||||
  a `SemVer` object or `null`.
 | 
			
		||||
 | 
			
		||||
### Comparison
 | 
			
		||||
 | 
			
		||||
* `gt(v1, v2)`: `v1 > v2`
 | 
			
		||||
* `gte(v1, v2)`: `v1 >= v2`
 | 
			
		||||
* `lt(v1, v2)`: `v1 < v2`
 | 
			
		||||
* `lte(v1, v2)`: `v1 <= v2`
 | 
			
		||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
 | 
			
		||||
  even if they're not the same string.  You already know how to
 | 
			
		||||
  compare strings.
 | 
			
		||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
 | 
			
		||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
 | 
			
		||||
  the corresponding function above.  `"==="` and `"!=="` do simple
 | 
			
		||||
  string comparison, but are included for completeness.  Throws if an
 | 
			
		||||
  invalid comparison string is provided.
 | 
			
		||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
 | 
			
		||||
  `v2` is greater.  Sorts in ascending order if passed to `Array.sort()`.
 | 
			
		||||
* `rcompare(v1, v2)`: The reverse of `compare`.  Sorts an array of versions
 | 
			
		||||
  in descending order when passed to `Array.sort()`.
 | 
			
		||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
 | 
			
		||||
  are equal.  Sorts in ascending order if passed to `Array.sort()`.
 | 
			
		||||
* `compareLoose(v1, v2)`: Short for `compare(v1, v2, { loose: true })`.
 | 
			
		||||
* `diff(v1, v2)`: Returns the difference between two versions by the release type
 | 
			
		||||
  (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
 | 
			
		||||
  or null if the versions are the same.
 | 
			
		||||
 | 
			
		||||
### Sorting
 | 
			
		||||
 | 
			
		||||
* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild` 
 | 
			
		||||
  function.
 | 
			
		||||
* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on
 | 
			
		||||
  the `compareBuild` function in descending order.
 | 
			
		||||
 | 
			
		||||
### Comparators
 | 
			
		||||
 | 
			
		||||
* `intersects(comparator)`: Return true if the comparators intersect
 | 
			
		||||
 | 
			
		||||
### Ranges
 | 
			
		||||
 | 
			
		||||
* `validRange(range)`: Return the valid range or null if it's not valid.
 | 
			
		||||
* `satisfies(version, range)`: Return true if the version satisfies the
 | 
			
		||||
  range.
 | 
			
		||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
 | 
			
		||||
  that satisfies the range, or `null` if none of them do.
 | 
			
		||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
 | 
			
		||||
  that satisfies the range, or `null` if none of them do.
 | 
			
		||||
* `minVersion(range)`: Return the lowest version that can match
 | 
			
		||||
  the given range.
 | 
			
		||||
* `gtr(version, range)`: Return `true` if the version is greater than all the
 | 
			
		||||
  versions possible in the range.
 | 
			
		||||
* `ltr(version, range)`: Return `true` if the version is less than all the
 | 
			
		||||
  versions possible in the range.
 | 
			
		||||
* `outside(version, range, hilo)`: Return true if the version is outside
 | 
			
		||||
  the bounds of the range in either the high or low direction.  The
 | 
			
		||||
  `hilo` argument must be either the string `'>'` or `'<'`.  (This is
 | 
			
		||||
  the function called by `gtr` and `ltr`.)
 | 
			
		||||
* `intersects(range)`: Return true if any of the range comparators intersect.
 | 
			
		||||
* `simplifyRange(versions, range)`: Return a "simplified" range that
 | 
			
		||||
  matches the same items in the `versions` list as the range specified.  Note
 | 
			
		||||
  that it does *not* guarantee that it would match the same versions in all
 | 
			
		||||
  cases, only for the set of versions provided.  This is useful when
 | 
			
		||||
  generating ranges by joining together multiple versions with `||`
 | 
			
		||||
  programmatically, to provide the user with something a bit more
 | 
			
		||||
  ergonomic.  If the provided range is shorter in string-length than the
 | 
			
		||||
  generated range, then that is returned.
 | 
			
		||||
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
 | 
			
		||||
  entirely contained by the `superRange` range.
 | 
			
		||||
 | 
			
		||||
Note that, since ranges may be non-contiguous, a version might not be
 | 
			
		||||
greater than a range, less than a range, *or* satisfy a range!  For
 | 
			
		||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
 | 
			
		||||
until `2.0.0`, so version `1.2.10` would not be greater than the
 | 
			
		||||
range (because `2.0.1` satisfies, which is higher), nor less than the
 | 
			
		||||
range (since `1.2.8` satisfies, which is lower), and it also does not
 | 
			
		||||
satisfy the range.
 | 
			
		||||
 | 
			
		||||
If you want to know if a version satisfies or does not satisfy a
 | 
			
		||||
range, use the `satisfies(version, range)` function.
 | 
			
		||||
 | 
			
		||||
### Coercion
 | 
			
		||||
 | 
			
		||||
* `coerce(version, options)`: Coerces a string to semver if possible
 | 
			
		||||
 | 
			
		||||
This aims to provide a very forgiving translation of a non-semver string to
 | 
			
		||||
semver. It looks for the first digit in a string and consumes all
 | 
			
		||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
 | 
			
		||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters).  Longer
 | 
			
		||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).  All
 | 
			
		||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
 | 
			
		||||
`3.4.0`).  Only text which lacks digits will fail coercion (`version one`
 | 
			
		||||
is not valid).  The maximum length for any semver component considered for
 | 
			
		||||
coercion is 16 characters; longer components will be ignored
 | 
			
		||||
(`10000000000000000.4.7.4` becomes `4.7.4`).  The maximum value for any
 | 
			
		||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
 | 
			
		||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
 | 
			
		||||
 | 
			
		||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
 | 
			
		||||
coercible tuple that does not share an ending index with a longer coercible
 | 
			
		||||
tuple.  For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
 | 
			
		||||
`4.0.0`.  `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
 | 
			
		||||
any other overlapping SemVer tuple.
 | 
			
		||||
 | 
			
		||||
If the `options.includePrerelease` flag is set, then the `coerce` result will contain
 | 
			
		||||
prerelease and build parts of a version.  For example, `1.2.3.4-rc.1+rev.2`
 | 
			
		||||
will preserve prerelease `rc.1` and build `rev.2` in the result.
 | 
			
		||||
 | 
			
		||||
### Clean
 | 
			
		||||
 | 
			
		||||
* `clean(version)`: Clean a string to be a valid semver if possible
 | 
			
		||||
 | 
			
		||||
This will return a cleaned and trimmed semver version. If the provided
 | 
			
		||||
version is not valid a null will be returned. This does not work for
 | 
			
		||||
ranges.
 | 
			
		||||
 | 
			
		||||
ex.
 | 
			
		||||
* `s.clean(' = v 2.1.5foo')`: `null`
 | 
			
		||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
 | 
			
		||||
* `s.clean(' = v 2.1.5-foo')`: `null`
 | 
			
		||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
 | 
			
		||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
 | 
			
		||||
* `s.clean('  =v2.1.5')`: `'2.1.5'`
 | 
			
		||||
* `s.clean('      2.1.5   ')`: `'2.1.5'`
 | 
			
		||||
* `s.clean('~1.0.0')`: `null`
 | 
			
		||||
 | 
			
		||||
## Constants
 | 
			
		||||
 | 
			
		||||
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
 | 
			
		||||
 | 
			
		||||
### `RELEASE_TYPES`
 | 
			
		||||
 | 
			
		||||
- major
 | 
			
		||||
- premajor
 | 
			
		||||
- minor
 | 
			
		||||
- preminor
 | 
			
		||||
- patch
 | 
			
		||||
- prepatch
 | 
			
		||||
- prerelease
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
const semver = require('semver');
 | 
			
		||||
 | 
			
		||||
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
 | 
			
		||||
  console.log('This is a valid release type!');
 | 
			
		||||
} else {
 | 
			
		||||
  console.warn('This is NOT a valid release type!');
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### `SEMVER_SPEC_VERSION`
 | 
			
		||||
 | 
			
		||||
2.0.0
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
const semver = require('semver');
 | 
			
		||||
 | 
			
		||||
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Exported Modules
 | 
			
		||||
 | 
			
		||||
<!--
 | 
			
		||||
TODO: Make sure that all of these items are documented (classes aren't,
 | 
			
		||||
eg), and then pull the module name into the documentation for that specific
 | 
			
		||||
thing.
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
You may pull in just the part of this semver utility that you need if you
 | 
			
		||||
are sensitive to packing and tree-shaking concerns.  The main
 | 
			
		||||
`require('semver')` export uses getter functions to lazily load the parts
 | 
			
		||||
of the API that are used.
 | 
			
		||||
 | 
			
		||||
The following modules are available:
 | 
			
		||||
 | 
			
		||||
* `require('semver')`
 | 
			
		||||
* `require('semver/classes')`
 | 
			
		||||
* `require('semver/classes/comparator')`
 | 
			
		||||
* `require('semver/classes/range')`
 | 
			
		||||
* `require('semver/classes/semver')`
 | 
			
		||||
* `require('semver/functions/clean')`
 | 
			
		||||
* `require('semver/functions/cmp')`
 | 
			
		||||
* `require('semver/functions/coerce')`
 | 
			
		||||
* `require('semver/functions/compare')`
 | 
			
		||||
* `require('semver/functions/compare-build')`
 | 
			
		||||
* `require('semver/functions/compare-loose')`
 | 
			
		||||
* `require('semver/functions/diff')`
 | 
			
		||||
* `require('semver/functions/eq')`
 | 
			
		||||
* `require('semver/functions/gt')`
 | 
			
		||||
* `require('semver/functions/gte')`
 | 
			
		||||
* `require('semver/functions/inc')`
 | 
			
		||||
* `require('semver/functions/lt')`
 | 
			
		||||
* `require('semver/functions/lte')`
 | 
			
		||||
* `require('semver/functions/major')`
 | 
			
		||||
* `require('semver/functions/minor')`
 | 
			
		||||
* `require('semver/functions/neq')`
 | 
			
		||||
* `require('semver/functions/parse')`
 | 
			
		||||
* `require('semver/functions/patch')`
 | 
			
		||||
* `require('semver/functions/prerelease')`
 | 
			
		||||
* `require('semver/functions/rcompare')`
 | 
			
		||||
* `require('semver/functions/rsort')`
 | 
			
		||||
* `require('semver/functions/satisfies')`
 | 
			
		||||
* `require('semver/functions/sort')`
 | 
			
		||||
* `require('semver/functions/valid')`
 | 
			
		||||
* `require('semver/ranges/gtr')`
 | 
			
		||||
* `require('semver/ranges/intersects')`
 | 
			
		||||
* `require('semver/ranges/ltr')`
 | 
			
		||||
* `require('semver/ranges/max-satisfying')`
 | 
			
		||||
* `require('semver/ranges/min-satisfying')`
 | 
			
		||||
* `require('semver/ranges/min-version')`
 | 
			
		||||
* `require('semver/ranges/outside')`
 | 
			
		||||
* `require('semver/ranges/simplify')`
 | 
			
		||||
* `require('semver/ranges/subset')`
 | 
			
		||||
* `require('semver/ranges/to-comparators')`
 | 
			
		||||
* `require('semver/ranges/valid')`
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										191
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/bin/semver.js
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										191
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/bin/semver.js
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,191 @@
 | 
			
		||||
#!/usr/bin/env node
 | 
			
		||||
// Standalone semver comparison program.
 | 
			
		||||
// Exits successfully and prints matching version(s) if
 | 
			
		||||
// any supplied version is valid and passes all tests.
 | 
			
		||||
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const argv = process.argv.slice(2)
 | 
			
		||||
 | 
			
		||||
let versions = []
 | 
			
		||||
 | 
			
		||||
const range = []
 | 
			
		||||
 | 
			
		||||
let inc = null
 | 
			
		||||
 | 
			
		||||
const version = require('../package.json').version
 | 
			
		||||
 | 
			
		||||
let loose = false
 | 
			
		||||
 | 
			
		||||
let includePrerelease = false
 | 
			
		||||
 | 
			
		||||
let coerce = false
 | 
			
		||||
 | 
			
		||||
let rtl = false
 | 
			
		||||
 | 
			
		||||
let identifier
 | 
			
		||||
 | 
			
		||||
let identifierBase
 | 
			
		||||
 | 
			
		||||
const semver = require('../')
 | 
			
		||||
const parseOptions = require('../internal/parse-options')
 | 
			
		||||
 | 
			
		||||
let reverse = false
 | 
			
		||||
 | 
			
		||||
let options = {}
 | 
			
		||||
 | 
			
		||||
const main = () => {
 | 
			
		||||
  if (!argv.length) {
 | 
			
		||||
    return help()
 | 
			
		||||
  }
 | 
			
		||||
  while (argv.length) {
 | 
			
		||||
    let a = argv.shift()
 | 
			
		||||
    const indexOfEqualSign = a.indexOf('=')
 | 
			
		||||
    if (indexOfEqualSign !== -1) {
 | 
			
		||||
      const value = a.slice(indexOfEqualSign + 1)
 | 
			
		||||
      a = a.slice(0, indexOfEqualSign)
 | 
			
		||||
      argv.unshift(value)
 | 
			
		||||
    }
 | 
			
		||||
    switch (a) {
 | 
			
		||||
      case '-rv': case '-rev': case '--rev': case '--reverse':
 | 
			
		||||
        reverse = true
 | 
			
		||||
        break
 | 
			
		||||
      case '-l': case '--loose':
 | 
			
		||||
        loose = true
 | 
			
		||||
        break
 | 
			
		||||
      case '-p': case '--include-prerelease':
 | 
			
		||||
        includePrerelease = true
 | 
			
		||||
        break
 | 
			
		||||
      case '-v': case '--version':
 | 
			
		||||
        versions.push(argv.shift())
 | 
			
		||||
        break
 | 
			
		||||
      case '-i': case '--inc': case '--increment':
 | 
			
		||||
        switch (argv[0]) {
 | 
			
		||||
          case 'major': case 'minor': case 'patch': case 'prerelease':
 | 
			
		||||
          case 'premajor': case 'preminor': case 'prepatch':
 | 
			
		||||
          case 'release':
 | 
			
		||||
            inc = argv.shift()
 | 
			
		||||
            break
 | 
			
		||||
          default:
 | 
			
		||||
            inc = 'patch'
 | 
			
		||||
            break
 | 
			
		||||
        }
 | 
			
		||||
        break
 | 
			
		||||
      case '--preid':
 | 
			
		||||
        identifier = argv.shift()
 | 
			
		||||
        break
 | 
			
		||||
      case '-r': case '--range':
 | 
			
		||||
        range.push(argv.shift())
 | 
			
		||||
        break
 | 
			
		||||
      case '-n':
 | 
			
		||||
        identifierBase = argv.shift()
 | 
			
		||||
        if (identifierBase === 'false') {
 | 
			
		||||
          identifierBase = false
 | 
			
		||||
        }
 | 
			
		||||
        break
 | 
			
		||||
      case '-c': case '--coerce':
 | 
			
		||||
        coerce = true
 | 
			
		||||
        break
 | 
			
		||||
      case '--rtl':
 | 
			
		||||
        rtl = true
 | 
			
		||||
        break
 | 
			
		||||
      case '--ltr':
 | 
			
		||||
        rtl = false
 | 
			
		||||
        break
 | 
			
		||||
      case '-h': case '--help': case '-?':
 | 
			
		||||
        return help()
 | 
			
		||||
      default:
 | 
			
		||||
        versions.push(a)
 | 
			
		||||
        break
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  options = parseOptions({ loose, includePrerelease, rtl })
 | 
			
		||||
 | 
			
		||||
  versions = versions.map((v) => {
 | 
			
		||||
    return coerce ? (semver.coerce(v, options) || { version: v }).version : v
 | 
			
		||||
  }).filter((v) => {
 | 
			
		||||
    return semver.valid(v)
 | 
			
		||||
  })
 | 
			
		||||
  if (!versions.length) {
 | 
			
		||||
    return fail()
 | 
			
		||||
  }
 | 
			
		||||
  if (inc && (versions.length !== 1 || range.length)) {
 | 
			
		||||
    return failInc()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  for (let i = 0, l = range.length; i < l; i++) {
 | 
			
		||||
    versions = versions.filter((v) => {
 | 
			
		||||
      return semver.satisfies(v, range[i], options)
 | 
			
		||||
    })
 | 
			
		||||
    if (!versions.length) {
 | 
			
		||||
      return fail()
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  versions
 | 
			
		||||
    .sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
 | 
			
		||||
    .map(v => semver.clean(v, options))
 | 
			
		||||
    .map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
 | 
			
		||||
    .forEach(v => console.log(v))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const failInc = () => {
 | 
			
		||||
  console.error('--inc can only be used on a single version with no range')
 | 
			
		||||
  fail()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const fail = () => process.exit(1)
 | 
			
		||||
 | 
			
		||||
const help = () => console.log(
 | 
			
		||||
`SemVer ${version}
 | 
			
		||||
 | 
			
		||||
A JavaScript implementation of the https://semver.org/ specification
 | 
			
		||||
Copyright Isaac Z. Schlueter
 | 
			
		||||
 | 
			
		||||
Usage: semver [options] <version> [<version> [...]]
 | 
			
		||||
Prints valid versions sorted by SemVer precedence
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
-r --range <range>
 | 
			
		||||
        Print versions that match the specified range.
 | 
			
		||||
 | 
			
		||||
-i --increment [<level>]
 | 
			
		||||
        Increment a version by the specified level.  Level can
 | 
			
		||||
        be one of: major, minor, patch, premajor, preminor,
 | 
			
		||||
        prepatch, prerelease, or release.  Default level is 'patch'.
 | 
			
		||||
        Only one version may be specified.
 | 
			
		||||
 | 
			
		||||
--preid <identifier>
 | 
			
		||||
        Identifier to be used to prefix premajor, preminor,
 | 
			
		||||
        prepatch or prerelease version increments.
 | 
			
		||||
 | 
			
		||||
-l --loose
 | 
			
		||||
        Interpret versions and ranges loosely
 | 
			
		||||
 | 
			
		||||
-p --include-prerelease
 | 
			
		||||
        Always include prerelease versions in range matching
 | 
			
		||||
 | 
			
		||||
-c --coerce
 | 
			
		||||
        Coerce a string into SemVer if possible
 | 
			
		||||
        (does not imply --loose)
 | 
			
		||||
 | 
			
		||||
--rtl
 | 
			
		||||
        Coerce version strings right to left
 | 
			
		||||
 | 
			
		||||
--ltr
 | 
			
		||||
        Coerce version strings left to right (default)
 | 
			
		||||
 | 
			
		||||
-n <base>
 | 
			
		||||
        Base number to be used for the prerelease identifier.
 | 
			
		||||
        Can be either 0 or 1, or false to omit the number altogether.
 | 
			
		||||
        Defaults to 0.
 | 
			
		||||
 | 
			
		||||
Program exits successfully if any valid version satisfies
 | 
			
		||||
all supplied ranges, and prints all satisfying versions.
 | 
			
		||||
 | 
			
		||||
If no satisfying versions are found, then exits failure.
 | 
			
		||||
 | 
			
		||||
Versions are printed in ascending order, so supplying
 | 
			
		||||
multiple versions to the utility will just sort them.`)
 | 
			
		||||
 | 
			
		||||
main()
 | 
			
		||||
							
								
								
									
										143
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/comparator.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/comparator.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,143 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const ANY = Symbol('SemVer ANY')
 | 
			
		||||
// hoisted class for cyclic dependency
 | 
			
		||||
class Comparator {
 | 
			
		||||
  static get ANY () {
 | 
			
		||||
    return ANY
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  constructor (comp, options) {
 | 
			
		||||
    options = parseOptions(options)
 | 
			
		||||
 | 
			
		||||
    if (comp instanceof Comparator) {
 | 
			
		||||
      if (comp.loose === !!options.loose) {
 | 
			
		||||
        return comp
 | 
			
		||||
      } else {
 | 
			
		||||
        comp = comp.value
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    comp = comp.trim().split(/\s+/).join(' ')
 | 
			
		||||
    debug('comparator', comp, options)
 | 
			
		||||
    this.options = options
 | 
			
		||||
    this.loose = !!options.loose
 | 
			
		||||
    this.parse(comp)
 | 
			
		||||
 | 
			
		||||
    if (this.semver === ANY) {
 | 
			
		||||
      this.value = ''
 | 
			
		||||
    } else {
 | 
			
		||||
      this.value = this.operator + this.semver.version
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    debug('comp', this)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  parse (comp) {
 | 
			
		||||
    const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
 | 
			
		||||
    const m = comp.match(r)
 | 
			
		||||
 | 
			
		||||
    if (!m) {
 | 
			
		||||
      throw new TypeError(`Invalid comparator: ${comp}`)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.operator = m[1] !== undefined ? m[1] : ''
 | 
			
		||||
    if (this.operator === '=') {
 | 
			
		||||
      this.operator = ''
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // if it literally is just '>' or '' then allow anything.
 | 
			
		||||
    if (!m[2]) {
 | 
			
		||||
      this.semver = ANY
 | 
			
		||||
    } else {
 | 
			
		||||
      this.semver = new SemVer(m[2], this.options.loose)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  toString () {
 | 
			
		||||
    return this.value
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  test (version) {
 | 
			
		||||
    debug('Comparator.test', version, this.options.loose)
 | 
			
		||||
 | 
			
		||||
    if (this.semver === ANY || version === ANY) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (typeof version === 'string') {
 | 
			
		||||
      try {
 | 
			
		||||
        version = new SemVer(version, this.options)
 | 
			
		||||
      } catch (er) {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return cmp(version, this.operator, this.semver, this.options)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  intersects (comp, options) {
 | 
			
		||||
    if (!(comp instanceof Comparator)) {
 | 
			
		||||
      throw new TypeError('a Comparator is required')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.operator === '') {
 | 
			
		||||
      if (this.value === '') {
 | 
			
		||||
        return true
 | 
			
		||||
      }
 | 
			
		||||
      return new Range(comp.value, options).test(this.value)
 | 
			
		||||
    } else if (comp.operator === '') {
 | 
			
		||||
      if (comp.value === '') {
 | 
			
		||||
        return true
 | 
			
		||||
      }
 | 
			
		||||
      return new Range(this.value, options).test(comp.semver)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    options = parseOptions(options)
 | 
			
		||||
 | 
			
		||||
    // Special cases where nothing can possibly be lower
 | 
			
		||||
    if (options.includePrerelease &&
 | 
			
		||||
      (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
    if (!options.includePrerelease &&
 | 
			
		||||
      (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Same direction increasing (> or >=)
 | 
			
		||||
    if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    // Same direction decreasing (< or <=)
 | 
			
		||||
    if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    // same SemVer and both sides are inclusive (<= or >=)
 | 
			
		||||
    if (
 | 
			
		||||
      (this.semver.version === comp.semver.version) &&
 | 
			
		||||
      this.operator.includes('=') && comp.operator.includes('=')) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    // opposite directions less than
 | 
			
		||||
    if (cmp(this.semver, '<', comp.semver, options) &&
 | 
			
		||||
      this.operator.startsWith('>') && comp.operator.startsWith('<')) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    // opposite directions greater than
 | 
			
		||||
    if (cmp(this.semver, '>', comp.semver, options) &&
 | 
			
		||||
      this.operator.startsWith('<') && comp.operator.startsWith('>')) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = Comparator
 | 
			
		||||
 | 
			
		||||
const parseOptions = require('../internal/parse-options')
 | 
			
		||||
const { safeRe: re, t } = require('../internal/re')
 | 
			
		||||
const cmp = require('../functions/cmp')
 | 
			
		||||
const debug = require('../internal/debug')
 | 
			
		||||
const SemVer = require('./semver')
 | 
			
		||||
const Range = require('./range')
 | 
			
		||||
							
								
								
									
										7
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  SemVer: require('./semver.js'),
 | 
			
		||||
  Range: require('./range.js'),
 | 
			
		||||
  Comparator: require('./comparator.js'),
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										557
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/range.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										557
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/range.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,557 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SPACE_CHARACTERS = /\s+/g
 | 
			
		||||
 | 
			
		||||
// hoisted class for cyclic dependency
 | 
			
		||||
class Range {
 | 
			
		||||
  constructor (range, options) {
 | 
			
		||||
    options = parseOptions(options)
 | 
			
		||||
 | 
			
		||||
    if (range instanceof Range) {
 | 
			
		||||
      if (
 | 
			
		||||
        range.loose === !!options.loose &&
 | 
			
		||||
        range.includePrerelease === !!options.includePrerelease
 | 
			
		||||
      ) {
 | 
			
		||||
        return range
 | 
			
		||||
      } else {
 | 
			
		||||
        return new Range(range.raw, options)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (range instanceof Comparator) {
 | 
			
		||||
      // just put it in the set and return
 | 
			
		||||
      this.raw = range.value
 | 
			
		||||
      this.set = [[range]]
 | 
			
		||||
      this.formatted = undefined
 | 
			
		||||
      return this
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.options = options
 | 
			
		||||
    this.loose = !!options.loose
 | 
			
		||||
    this.includePrerelease = !!options.includePrerelease
 | 
			
		||||
 | 
			
		||||
    // First reduce all whitespace as much as possible so we do not have to rely
 | 
			
		||||
    // on potentially slow regexes like \s*. This is then stored and used for
 | 
			
		||||
    // future error messages as well.
 | 
			
		||||
    this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
 | 
			
		||||
 | 
			
		||||
    // First, split on ||
 | 
			
		||||
    this.set = this.raw
 | 
			
		||||
      .split('||')
 | 
			
		||||
      // map the range to a 2d array of comparators
 | 
			
		||||
      .map(r => this.parseRange(r.trim()))
 | 
			
		||||
      // throw out any comparator lists that are empty
 | 
			
		||||
      // this generally means that it was not a valid range, which is allowed
 | 
			
		||||
      // in loose mode, but will still throw if the WHOLE range is invalid.
 | 
			
		||||
      .filter(c => c.length)
 | 
			
		||||
 | 
			
		||||
    if (!this.set.length) {
 | 
			
		||||
      throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // if we have any that are not the null set, throw out null sets.
 | 
			
		||||
    if (this.set.length > 1) {
 | 
			
		||||
      // keep the first one, in case they're all null sets
 | 
			
		||||
      const first = this.set[0]
 | 
			
		||||
      this.set = this.set.filter(c => !isNullSet(c[0]))
 | 
			
		||||
      if (this.set.length === 0) {
 | 
			
		||||
        this.set = [first]
 | 
			
		||||
      } else if (this.set.length > 1) {
 | 
			
		||||
        // if we have any that are *, then the range is just *
 | 
			
		||||
        for (const c of this.set) {
 | 
			
		||||
          if (c.length === 1 && isAny(c[0])) {
 | 
			
		||||
            this.set = [c]
 | 
			
		||||
            break
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.formatted = undefined
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get range () {
 | 
			
		||||
    if (this.formatted === undefined) {
 | 
			
		||||
      this.formatted = ''
 | 
			
		||||
      for (let i = 0; i < this.set.length; i++) {
 | 
			
		||||
        if (i > 0) {
 | 
			
		||||
          this.formatted += '||'
 | 
			
		||||
        }
 | 
			
		||||
        const comps = this.set[i]
 | 
			
		||||
        for (let k = 0; k < comps.length; k++) {
 | 
			
		||||
          if (k > 0) {
 | 
			
		||||
            this.formatted += ' '
 | 
			
		||||
          }
 | 
			
		||||
          this.formatted += comps[k].toString().trim()
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return this.formatted
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  format () {
 | 
			
		||||
    return this.range
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  toString () {
 | 
			
		||||
    return this.range
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  parseRange (range) {
 | 
			
		||||
    // memoize range parsing for performance.
 | 
			
		||||
    // this is a very hot path, and fully deterministic.
 | 
			
		||||
    const memoOpts =
 | 
			
		||||
      (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
 | 
			
		||||
      (this.options.loose && FLAG_LOOSE)
 | 
			
		||||
    const memoKey = memoOpts + ':' + range
 | 
			
		||||
    const cached = cache.get(memoKey)
 | 
			
		||||
    if (cached) {
 | 
			
		||||
      return cached
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const loose = this.options.loose
 | 
			
		||||
    // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
 | 
			
		||||
    const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
 | 
			
		||||
    range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
 | 
			
		||||
    debug('hyphen replace', range)
 | 
			
		||||
 | 
			
		||||
    // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
 | 
			
		||||
    range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
 | 
			
		||||
    debug('comparator trim', range)
 | 
			
		||||
 | 
			
		||||
    // `~ 1.2.3` => `~1.2.3`
 | 
			
		||||
    range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
 | 
			
		||||
    debug('tilde trim', range)
 | 
			
		||||
 | 
			
		||||
    // `^ 1.2.3` => `^1.2.3`
 | 
			
		||||
    range = range.replace(re[t.CARETTRIM], caretTrimReplace)
 | 
			
		||||
    debug('caret trim', range)
 | 
			
		||||
 | 
			
		||||
    // At this point, the range is completely trimmed and
 | 
			
		||||
    // ready to be split into comparators.
 | 
			
		||||
 | 
			
		||||
    let rangeList = range
 | 
			
		||||
      .split(' ')
 | 
			
		||||
      .map(comp => parseComparator(comp, this.options))
 | 
			
		||||
      .join(' ')
 | 
			
		||||
      .split(/\s+/)
 | 
			
		||||
      // >=0.0.0 is equivalent to *
 | 
			
		||||
      .map(comp => replaceGTE0(comp, this.options))
 | 
			
		||||
 | 
			
		||||
    if (loose) {
 | 
			
		||||
      // in loose mode, throw out any that are not valid comparators
 | 
			
		||||
      rangeList = rangeList.filter(comp => {
 | 
			
		||||
        debug('loose invalid filter', comp, this.options)
 | 
			
		||||
        return !!comp.match(re[t.COMPARATORLOOSE])
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
    debug('range list', rangeList)
 | 
			
		||||
 | 
			
		||||
    // if any comparators are the null set, then replace with JUST null set
 | 
			
		||||
    // if more than one comparator, remove any * comparators
 | 
			
		||||
    // also, don't include the same comparator more than once
 | 
			
		||||
    const rangeMap = new Map()
 | 
			
		||||
    const comparators = rangeList.map(comp => new Comparator(comp, this.options))
 | 
			
		||||
    for (const comp of comparators) {
 | 
			
		||||
      if (isNullSet(comp)) {
 | 
			
		||||
        return [comp]
 | 
			
		||||
      }
 | 
			
		||||
      rangeMap.set(comp.value, comp)
 | 
			
		||||
    }
 | 
			
		||||
    if (rangeMap.size > 1 && rangeMap.has('')) {
 | 
			
		||||
      rangeMap.delete('')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const result = [...rangeMap.values()]
 | 
			
		||||
    cache.set(memoKey, result)
 | 
			
		||||
    return result
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  intersects (range, options) {
 | 
			
		||||
    if (!(range instanceof Range)) {
 | 
			
		||||
      throw new TypeError('a Range is required')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return this.set.some((thisComparators) => {
 | 
			
		||||
      return (
 | 
			
		||||
        isSatisfiable(thisComparators, options) &&
 | 
			
		||||
        range.set.some((rangeComparators) => {
 | 
			
		||||
          return (
 | 
			
		||||
            isSatisfiable(rangeComparators, options) &&
 | 
			
		||||
            thisComparators.every((thisComparator) => {
 | 
			
		||||
              return rangeComparators.every((rangeComparator) => {
 | 
			
		||||
                return thisComparator.intersects(rangeComparator, options)
 | 
			
		||||
              })
 | 
			
		||||
            })
 | 
			
		||||
          )
 | 
			
		||||
        })
 | 
			
		||||
      )
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // if ANY of the sets match ALL of its comparators, then pass
 | 
			
		||||
  test (version) {
 | 
			
		||||
    if (!version) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (typeof version === 'string') {
 | 
			
		||||
      try {
 | 
			
		||||
        version = new SemVer(version, this.options)
 | 
			
		||||
      } catch (er) {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (let i = 0; i < this.set.length; i++) {
 | 
			
		||||
      if (testSet(this.set[i], version, this.options)) {
 | 
			
		||||
        return true
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = Range
 | 
			
		||||
 | 
			
		||||
const LRU = require('../internal/lrucache')
 | 
			
		||||
const cache = new LRU()
 | 
			
		||||
 | 
			
		||||
const parseOptions = require('../internal/parse-options')
 | 
			
		||||
const Comparator = require('./comparator')
 | 
			
		||||
const debug = require('../internal/debug')
 | 
			
		||||
const SemVer = require('./semver')
 | 
			
		||||
const {
 | 
			
		||||
  safeRe: re,
 | 
			
		||||
  t,
 | 
			
		||||
  comparatorTrimReplace,
 | 
			
		||||
  tildeTrimReplace,
 | 
			
		||||
  caretTrimReplace,
 | 
			
		||||
} = require('../internal/re')
 | 
			
		||||
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')
 | 
			
		||||
 | 
			
		||||
const isNullSet = c => c.value === '<0.0.0-0'
 | 
			
		||||
const isAny = c => c.value === ''
 | 
			
		||||
 | 
			
		||||
// take a set of comparators and determine whether there
 | 
			
		||||
// exists a version which can satisfy it
 | 
			
		||||
const isSatisfiable = (comparators, options) => {
 | 
			
		||||
  let result = true
 | 
			
		||||
  const remainingComparators = comparators.slice()
 | 
			
		||||
  let testComparator = remainingComparators.pop()
 | 
			
		||||
 | 
			
		||||
  while (result && remainingComparators.length) {
 | 
			
		||||
    result = remainingComparators.every((otherComparator) => {
 | 
			
		||||
      return testComparator.intersects(otherComparator, options)
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    testComparator = remainingComparators.pop()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
 | 
			
		||||
// already replaced the hyphen ranges
 | 
			
		||||
// turn into a set of JUST comparators.
 | 
			
		||||
const parseComparator = (comp, options) => {
 | 
			
		||||
  comp = comp.replace(re[t.BUILD], '')
 | 
			
		||||
  debug('comp', comp, options)
 | 
			
		||||
  comp = replaceCarets(comp, options)
 | 
			
		||||
  debug('caret', comp)
 | 
			
		||||
  comp = replaceTildes(comp, options)
 | 
			
		||||
  debug('tildes', comp)
 | 
			
		||||
  comp = replaceXRanges(comp, options)
 | 
			
		||||
  debug('xrange', comp)
 | 
			
		||||
  comp = replaceStars(comp, options)
 | 
			
		||||
  debug('stars', comp)
 | 
			
		||||
  return comp
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
 | 
			
		||||
 | 
			
		||||
// ~, ~> --> * (any, kinda silly)
 | 
			
		||||
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
 | 
			
		||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
 | 
			
		||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
 | 
			
		||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
 | 
			
		||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
 | 
			
		||||
// ~0.0.1 --> >=0.0.1 <0.1.0-0
 | 
			
		||||
const replaceTildes = (comp, options) => {
 | 
			
		||||
  return comp
 | 
			
		||||
    .trim()
 | 
			
		||||
    .split(/\s+/)
 | 
			
		||||
    .map((c) => replaceTilde(c, options))
 | 
			
		||||
    .join(' ')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const replaceTilde = (comp, options) => {
 | 
			
		||||
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
 | 
			
		||||
  return comp.replace(r, (_, M, m, p, pr) => {
 | 
			
		||||
    debug('tilde', comp, _, M, m, p, pr)
 | 
			
		||||
    let ret
 | 
			
		||||
 | 
			
		||||
    if (isX(M)) {
 | 
			
		||||
      ret = ''
 | 
			
		||||
    } else if (isX(m)) {
 | 
			
		||||
      ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
 | 
			
		||||
    } else if (isX(p)) {
 | 
			
		||||
      // ~1.2 == >=1.2.0 <1.3.0-0
 | 
			
		||||
      ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
 | 
			
		||||
    } else if (pr) {
 | 
			
		||||
      debug('replaceTilde pr', pr)
 | 
			
		||||
      ret = `>=${M}.${m}.${p}-${pr
 | 
			
		||||
      } <${M}.${+m + 1}.0-0`
 | 
			
		||||
    } else {
 | 
			
		||||
      // ~1.2.3 == >=1.2.3 <1.3.0-0
 | 
			
		||||
      ret = `>=${M}.${m}.${p
 | 
			
		||||
      } <${M}.${+m + 1}.0-0`
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    debug('tilde return', ret)
 | 
			
		||||
    return ret
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ^ --> * (any, kinda silly)
 | 
			
		||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
 | 
			
		||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
 | 
			
		||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
 | 
			
		||||
// ^1.2.3 --> >=1.2.3 <2.0.0-0
 | 
			
		||||
// ^1.2.0 --> >=1.2.0 <2.0.0-0
 | 
			
		||||
// ^0.0.1 --> >=0.0.1 <0.0.2-0
 | 
			
		||||
// ^0.1.0 --> >=0.1.0 <0.2.0-0
 | 
			
		||||
const replaceCarets = (comp, options) => {
 | 
			
		||||
  return comp
 | 
			
		||||
    .trim()
 | 
			
		||||
    .split(/\s+/)
 | 
			
		||||
    .map((c) => replaceCaret(c, options))
 | 
			
		||||
    .join(' ')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const replaceCaret = (comp, options) => {
 | 
			
		||||
  debug('caret', comp, options)
 | 
			
		||||
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
 | 
			
		||||
  const z = options.includePrerelease ? '-0' : ''
 | 
			
		||||
  return comp.replace(r, (_, M, m, p, pr) => {
 | 
			
		||||
    debug('caret', comp, _, M, m, p, pr)
 | 
			
		||||
    let ret
 | 
			
		||||
 | 
			
		||||
    if (isX(M)) {
 | 
			
		||||
      ret = ''
 | 
			
		||||
    } else if (isX(m)) {
 | 
			
		||||
      ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
 | 
			
		||||
    } else if (isX(p)) {
 | 
			
		||||
      if (M === '0') {
 | 
			
		||||
        ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
 | 
			
		||||
      } else {
 | 
			
		||||
        ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
 | 
			
		||||
      }
 | 
			
		||||
    } else if (pr) {
 | 
			
		||||
      debug('replaceCaret pr', pr)
 | 
			
		||||
      if (M === '0') {
 | 
			
		||||
        if (m === '0') {
 | 
			
		||||
          ret = `>=${M}.${m}.${p}-${pr
 | 
			
		||||
          } <${M}.${m}.${+p + 1}-0`
 | 
			
		||||
        } else {
 | 
			
		||||
          ret = `>=${M}.${m}.${p}-${pr
 | 
			
		||||
          } <${M}.${+m + 1}.0-0`
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        ret = `>=${M}.${m}.${p}-${pr
 | 
			
		||||
        } <${+M + 1}.0.0-0`
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      debug('no pr')
 | 
			
		||||
      if (M === '0') {
 | 
			
		||||
        if (m === '0') {
 | 
			
		||||
          ret = `>=${M}.${m}.${p
 | 
			
		||||
          }${z} <${M}.${m}.${+p + 1}-0`
 | 
			
		||||
        } else {
 | 
			
		||||
          ret = `>=${M}.${m}.${p
 | 
			
		||||
          }${z} <${M}.${+m + 1}.0-0`
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        ret = `>=${M}.${m}.${p
 | 
			
		||||
        } <${+M + 1}.0.0-0`
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    debug('caret return', ret)
 | 
			
		||||
    return ret
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const replaceXRanges = (comp, options) => {
 | 
			
		||||
  debug('replaceXRanges', comp, options)
 | 
			
		||||
  return comp
 | 
			
		||||
    .split(/\s+/)
 | 
			
		||||
    .map((c) => replaceXRange(c, options))
 | 
			
		||||
    .join(' ')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const replaceXRange = (comp, options) => {
 | 
			
		||||
  comp = comp.trim()
 | 
			
		||||
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
 | 
			
		||||
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
 | 
			
		||||
    debug('xRange', comp, ret, gtlt, M, m, p, pr)
 | 
			
		||||
    const xM = isX(M)
 | 
			
		||||
    const xm = xM || isX(m)
 | 
			
		||||
    const xp = xm || isX(p)
 | 
			
		||||
    const anyX = xp
 | 
			
		||||
 | 
			
		||||
    if (gtlt === '=' && anyX) {
 | 
			
		||||
      gtlt = ''
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // if we're including prereleases in the match, then we need
 | 
			
		||||
    // to fix this to -0, the lowest possible prerelease value
 | 
			
		||||
    pr = options.includePrerelease ? '-0' : ''
 | 
			
		||||
 | 
			
		||||
    if (xM) {
 | 
			
		||||
      if (gtlt === '>' || gtlt === '<') {
 | 
			
		||||
        // nothing is allowed
 | 
			
		||||
        ret = '<0.0.0-0'
 | 
			
		||||
      } else {
 | 
			
		||||
        // nothing is forbidden
 | 
			
		||||
        ret = '*'
 | 
			
		||||
      }
 | 
			
		||||
    } else if (gtlt && anyX) {
 | 
			
		||||
      // we know patch is an x, because we have any x at all.
 | 
			
		||||
      // replace X with 0
 | 
			
		||||
      if (xm) {
 | 
			
		||||
        m = 0
 | 
			
		||||
      }
 | 
			
		||||
      p = 0
 | 
			
		||||
 | 
			
		||||
      if (gtlt === '>') {
 | 
			
		||||
        // >1 => >=2.0.0
 | 
			
		||||
        // >1.2 => >=1.3.0
 | 
			
		||||
        gtlt = '>='
 | 
			
		||||
        if (xm) {
 | 
			
		||||
          M = +M + 1
 | 
			
		||||
          m = 0
 | 
			
		||||
          p = 0
 | 
			
		||||
        } else {
 | 
			
		||||
          m = +m + 1
 | 
			
		||||
          p = 0
 | 
			
		||||
        }
 | 
			
		||||
      } else if (gtlt === '<=') {
 | 
			
		||||
        // <=0.7.x is actually <0.8.0, since any 0.7.x should
 | 
			
		||||
        // pass.  Similarly, <=7.x is actually <8.0.0, etc.
 | 
			
		||||
        gtlt = '<'
 | 
			
		||||
        if (xm) {
 | 
			
		||||
          M = +M + 1
 | 
			
		||||
        } else {
 | 
			
		||||
          m = +m + 1
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (gtlt === '<') {
 | 
			
		||||
        pr = '-0'
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ret = `${gtlt + M}.${m}.${p}${pr}`
 | 
			
		||||
    } else if (xm) {
 | 
			
		||||
      ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
 | 
			
		||||
    } else if (xp) {
 | 
			
		||||
      ret = `>=${M}.${m}.0${pr
 | 
			
		||||
      } <${M}.${+m + 1}.0-0`
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    debug('xRange return', ret)
 | 
			
		||||
 | 
			
		||||
    return ret
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Because * is AND-ed with everything else in the comparator,
 | 
			
		||||
// and '' means "any version", just remove the *s entirely.
 | 
			
		||||
const replaceStars = (comp, options) => {
 | 
			
		||||
  debug('replaceStars', comp, options)
 | 
			
		||||
  // Looseness is ignored here.  star is always as loose as it gets!
 | 
			
		||||
  return comp
 | 
			
		||||
    .trim()
 | 
			
		||||
    .replace(re[t.STAR], '')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const replaceGTE0 = (comp, options) => {
 | 
			
		||||
  debug('replaceGTE0', comp, options)
 | 
			
		||||
  return comp
 | 
			
		||||
    .trim()
 | 
			
		||||
    .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
 | 
			
		||||
// M, m, patch, prerelease, build
 | 
			
		||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
 | 
			
		||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
 | 
			
		||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
 | 
			
		||||
// TODO build?
 | 
			
		||||
const hyphenReplace = incPr => ($0,
 | 
			
		||||
  from, fM, fm, fp, fpr, fb,
 | 
			
		||||
  to, tM, tm, tp, tpr) => {
 | 
			
		||||
  if (isX(fM)) {
 | 
			
		||||
    from = ''
 | 
			
		||||
  } else if (isX(fm)) {
 | 
			
		||||
    from = `>=${fM}.0.0${incPr ? '-0' : ''}`
 | 
			
		||||
  } else if (isX(fp)) {
 | 
			
		||||
    from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
 | 
			
		||||
  } else if (fpr) {
 | 
			
		||||
    from = `>=${from}`
 | 
			
		||||
  } else {
 | 
			
		||||
    from = `>=${from}${incPr ? '-0' : ''}`
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (isX(tM)) {
 | 
			
		||||
    to = ''
 | 
			
		||||
  } else if (isX(tm)) {
 | 
			
		||||
    to = `<${+tM + 1}.0.0-0`
 | 
			
		||||
  } else if (isX(tp)) {
 | 
			
		||||
    to = `<${tM}.${+tm + 1}.0-0`
 | 
			
		||||
  } else if (tpr) {
 | 
			
		||||
    to = `<=${tM}.${tm}.${tp}-${tpr}`
 | 
			
		||||
  } else if (incPr) {
 | 
			
		||||
    to = `<${tM}.${tm}.${+tp + 1}-0`
 | 
			
		||||
  } else {
 | 
			
		||||
    to = `<=${to}`
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return `${from} ${to}`.trim()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const testSet = (set, version, options) => {
 | 
			
		||||
  for (let i = 0; i < set.length; i++) {
 | 
			
		||||
    if (!set[i].test(version)) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (version.prerelease.length && !options.includePrerelease) {
 | 
			
		||||
    // Find the set of versions that are allowed to have prereleases
 | 
			
		||||
    // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
 | 
			
		||||
    // That should allow `1.2.3-pr.2` to pass.
 | 
			
		||||
    // However, `1.2.4-alpha.notready` should NOT be allowed,
 | 
			
		||||
    // even though it's within the range set by the comparators.
 | 
			
		||||
    for (let i = 0; i < set.length; i++) {
 | 
			
		||||
      debug(set[i].semver)
 | 
			
		||||
      if (set[i].semver === Comparator.ANY) {
 | 
			
		||||
        continue
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (set[i].semver.prerelease.length > 0) {
 | 
			
		||||
        const allowed = set[i].semver
 | 
			
		||||
        if (allowed.major === version.major &&
 | 
			
		||||
            allowed.minor === version.minor &&
 | 
			
		||||
            allowed.patch === version.patch) {
 | 
			
		||||
          return true
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Version has a -pre, but it's not one of the ones we like.
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return true
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										333
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/semver.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										333
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/classes/semver.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,333 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const debug = require('../internal/debug')
 | 
			
		||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
 | 
			
		||||
const { safeRe: re, t } = require('../internal/re')
 | 
			
		||||
 | 
			
		||||
const parseOptions = require('../internal/parse-options')
 | 
			
		||||
const { compareIdentifiers } = require('../internal/identifiers')
 | 
			
		||||
class SemVer {
 | 
			
		||||
  constructor (version, options) {
 | 
			
		||||
    options = parseOptions(options)
 | 
			
		||||
 | 
			
		||||
    if (version instanceof SemVer) {
 | 
			
		||||
      if (version.loose === !!options.loose &&
 | 
			
		||||
        version.includePrerelease === !!options.includePrerelease) {
 | 
			
		||||
        return version
 | 
			
		||||
      } else {
 | 
			
		||||
        version = version.version
 | 
			
		||||
      }
 | 
			
		||||
    } else if (typeof version !== 'string') {
 | 
			
		||||
      throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (version.length > MAX_LENGTH) {
 | 
			
		||||
      throw new TypeError(
 | 
			
		||||
        `version is longer than ${MAX_LENGTH} characters`
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    debug('SemVer', version, options)
 | 
			
		||||
    this.options = options
 | 
			
		||||
    this.loose = !!options.loose
 | 
			
		||||
    // this isn't actually relevant for versions, but keep it so that we
 | 
			
		||||
    // don't run into trouble passing this.options around.
 | 
			
		||||
    this.includePrerelease = !!options.includePrerelease
 | 
			
		||||
 | 
			
		||||
    const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
 | 
			
		||||
 | 
			
		||||
    if (!m) {
 | 
			
		||||
      throw new TypeError(`Invalid Version: ${version}`)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.raw = version
 | 
			
		||||
 | 
			
		||||
    // these are actually numbers
 | 
			
		||||
    this.major = +m[1]
 | 
			
		||||
    this.minor = +m[2]
 | 
			
		||||
    this.patch = +m[3]
 | 
			
		||||
 | 
			
		||||
    if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
 | 
			
		||||
      throw new TypeError('Invalid major version')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
 | 
			
		||||
      throw new TypeError('Invalid minor version')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
 | 
			
		||||
      throw new TypeError('Invalid patch version')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // numberify any prerelease numeric ids
 | 
			
		||||
    if (!m[4]) {
 | 
			
		||||
      this.prerelease = []
 | 
			
		||||
    } else {
 | 
			
		||||
      this.prerelease = m[4].split('.').map((id) => {
 | 
			
		||||
        if (/^[0-9]+$/.test(id)) {
 | 
			
		||||
          const num = +id
 | 
			
		||||
          if (num >= 0 && num < MAX_SAFE_INTEGER) {
 | 
			
		||||
            return num
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return id
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.build = m[5] ? m[5].split('.') : []
 | 
			
		||||
    this.format()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  format () {
 | 
			
		||||
    this.version = `${this.major}.${this.minor}.${this.patch}`
 | 
			
		||||
    if (this.prerelease.length) {
 | 
			
		||||
      this.version += `-${this.prerelease.join('.')}`
 | 
			
		||||
    }
 | 
			
		||||
    return this.version
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  toString () {
 | 
			
		||||
    return this.version
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  compare (other) {
 | 
			
		||||
    debug('SemVer.compare', this.version, this.options, other)
 | 
			
		||||
    if (!(other instanceof SemVer)) {
 | 
			
		||||
      if (typeof other === 'string' && other === this.version) {
 | 
			
		||||
        return 0
 | 
			
		||||
      }
 | 
			
		||||
      other = new SemVer(other, this.options)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (other.version === this.version) {
 | 
			
		||||
      return 0
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return this.compareMain(other) || this.comparePre(other)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  compareMain (other) {
 | 
			
		||||
    if (!(other instanceof SemVer)) {
 | 
			
		||||
      other = new SemVer(other, this.options)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.major < other.major) {
 | 
			
		||||
      return -1
 | 
			
		||||
    }
 | 
			
		||||
    if (this.major > other.major) {
 | 
			
		||||
      return 1
 | 
			
		||||
    }
 | 
			
		||||
    if (this.minor < other.minor) {
 | 
			
		||||
      return -1
 | 
			
		||||
    }
 | 
			
		||||
    if (this.minor > other.minor) {
 | 
			
		||||
      return 1
 | 
			
		||||
    }
 | 
			
		||||
    if (this.patch < other.patch) {
 | 
			
		||||
      return -1
 | 
			
		||||
    }
 | 
			
		||||
    if (this.patch > other.patch) {
 | 
			
		||||
      return 1
 | 
			
		||||
    }
 | 
			
		||||
    return 0
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  comparePre (other) {
 | 
			
		||||
    if (!(other instanceof SemVer)) {
 | 
			
		||||
      other = new SemVer(other, this.options)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // NOT having a prerelease is > having one
 | 
			
		||||
    if (this.prerelease.length && !other.prerelease.length) {
 | 
			
		||||
      return -1
 | 
			
		||||
    } else if (!this.prerelease.length && other.prerelease.length) {
 | 
			
		||||
      return 1
 | 
			
		||||
    } else if (!this.prerelease.length && !other.prerelease.length) {
 | 
			
		||||
      return 0
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let i = 0
 | 
			
		||||
    do {
 | 
			
		||||
      const a = this.prerelease[i]
 | 
			
		||||
      const b = other.prerelease[i]
 | 
			
		||||
      debug('prerelease compare', i, a, b)
 | 
			
		||||
      if (a === undefined && b === undefined) {
 | 
			
		||||
        return 0
 | 
			
		||||
      } else if (b === undefined) {
 | 
			
		||||
        return 1
 | 
			
		||||
      } else if (a === undefined) {
 | 
			
		||||
        return -1
 | 
			
		||||
      } else if (a === b) {
 | 
			
		||||
        continue
 | 
			
		||||
      } else {
 | 
			
		||||
        return compareIdentifiers(a, b)
 | 
			
		||||
      }
 | 
			
		||||
    } while (++i)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  compareBuild (other) {
 | 
			
		||||
    if (!(other instanceof SemVer)) {
 | 
			
		||||
      other = new SemVer(other, this.options)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let i = 0
 | 
			
		||||
    do {
 | 
			
		||||
      const a = this.build[i]
 | 
			
		||||
      const b = other.build[i]
 | 
			
		||||
      debug('build compare', i, a, b)
 | 
			
		||||
      if (a === undefined && b === undefined) {
 | 
			
		||||
        return 0
 | 
			
		||||
      } else if (b === undefined) {
 | 
			
		||||
        return 1
 | 
			
		||||
      } else if (a === undefined) {
 | 
			
		||||
        return -1
 | 
			
		||||
      } else if (a === b) {
 | 
			
		||||
        continue
 | 
			
		||||
      } else {
 | 
			
		||||
        return compareIdentifiers(a, b)
 | 
			
		||||
      }
 | 
			
		||||
    } while (++i)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // preminor will bump the version up to the next minor release, and immediately
 | 
			
		||||
  // down to pre-release. premajor and prepatch work the same way.
 | 
			
		||||
  inc (release, identifier, identifierBase) {
 | 
			
		||||
    if (release.startsWith('pre')) {
 | 
			
		||||
      if (!identifier && identifierBase === false) {
 | 
			
		||||
        throw new Error('invalid increment argument: identifier is empty')
 | 
			
		||||
      }
 | 
			
		||||
      // Avoid an invalid semver results
 | 
			
		||||
      if (identifier) {
 | 
			
		||||
        const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
 | 
			
		||||
        if (!match || match[1] !== identifier) {
 | 
			
		||||
          throw new Error(`invalid identifier: ${identifier}`)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch (release) {
 | 
			
		||||
      case 'premajor':
 | 
			
		||||
        this.prerelease.length = 0
 | 
			
		||||
        this.patch = 0
 | 
			
		||||
        this.minor = 0
 | 
			
		||||
        this.major++
 | 
			
		||||
        this.inc('pre', identifier, identifierBase)
 | 
			
		||||
        break
 | 
			
		||||
      case 'preminor':
 | 
			
		||||
        this.prerelease.length = 0
 | 
			
		||||
        this.patch = 0
 | 
			
		||||
        this.minor++
 | 
			
		||||
        this.inc('pre', identifier, identifierBase)
 | 
			
		||||
        break
 | 
			
		||||
      case 'prepatch':
 | 
			
		||||
        // If this is already a prerelease, it will bump to the next version
 | 
			
		||||
        // drop any prereleases that might already exist, since they are not
 | 
			
		||||
        // relevant at this point.
 | 
			
		||||
        this.prerelease.length = 0
 | 
			
		||||
        this.inc('patch', identifier, identifierBase)
 | 
			
		||||
        this.inc('pre', identifier, identifierBase)
 | 
			
		||||
        break
 | 
			
		||||
      // If the input is a non-prerelease version, this acts the same as
 | 
			
		||||
      // prepatch.
 | 
			
		||||
      case 'prerelease':
 | 
			
		||||
        if (this.prerelease.length === 0) {
 | 
			
		||||
          this.inc('patch', identifier, identifierBase)
 | 
			
		||||
        }
 | 
			
		||||
        this.inc('pre', identifier, identifierBase)
 | 
			
		||||
        break
 | 
			
		||||
      case 'release':
 | 
			
		||||
        if (this.prerelease.length === 0) {
 | 
			
		||||
          throw new Error(`version ${this.raw} is not a prerelease`)
 | 
			
		||||
        }
 | 
			
		||||
        this.prerelease.length = 0
 | 
			
		||||
        break
 | 
			
		||||
 | 
			
		||||
      case 'major':
 | 
			
		||||
        // If this is a pre-major version, bump up to the same major version.
 | 
			
		||||
        // Otherwise increment major.
 | 
			
		||||
        // 1.0.0-5 bumps to 1.0.0
 | 
			
		||||
        // 1.1.0 bumps to 2.0.0
 | 
			
		||||
        if (
 | 
			
		||||
          this.minor !== 0 ||
 | 
			
		||||
          this.patch !== 0 ||
 | 
			
		||||
          this.prerelease.length === 0
 | 
			
		||||
        ) {
 | 
			
		||||
          this.major++
 | 
			
		||||
        }
 | 
			
		||||
        this.minor = 0
 | 
			
		||||
        this.patch = 0
 | 
			
		||||
        this.prerelease = []
 | 
			
		||||
        break
 | 
			
		||||
      case 'minor':
 | 
			
		||||
        // If this is a pre-minor version, bump up to the same minor version.
 | 
			
		||||
        // Otherwise increment minor.
 | 
			
		||||
        // 1.2.0-5 bumps to 1.2.0
 | 
			
		||||
        // 1.2.1 bumps to 1.3.0
 | 
			
		||||
        if (this.patch !== 0 || this.prerelease.length === 0) {
 | 
			
		||||
          this.minor++
 | 
			
		||||
        }
 | 
			
		||||
        this.patch = 0
 | 
			
		||||
        this.prerelease = []
 | 
			
		||||
        break
 | 
			
		||||
      case 'patch':
 | 
			
		||||
        // If this is not a pre-release version, it will increment the patch.
 | 
			
		||||
        // If it is a pre-release it will bump up to the same patch version.
 | 
			
		||||
        // 1.2.0-5 patches to 1.2.0
 | 
			
		||||
        // 1.2.0 patches to 1.2.1
 | 
			
		||||
        if (this.prerelease.length === 0) {
 | 
			
		||||
          this.patch++
 | 
			
		||||
        }
 | 
			
		||||
        this.prerelease = []
 | 
			
		||||
        break
 | 
			
		||||
      // This probably shouldn't be used publicly.
 | 
			
		||||
      // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
 | 
			
		||||
      case 'pre': {
 | 
			
		||||
        const base = Number(identifierBase) ? 1 : 0
 | 
			
		||||
 | 
			
		||||
        if (this.prerelease.length === 0) {
 | 
			
		||||
          this.prerelease = [base]
 | 
			
		||||
        } else {
 | 
			
		||||
          let i = this.prerelease.length
 | 
			
		||||
          while (--i >= 0) {
 | 
			
		||||
            if (typeof this.prerelease[i] === 'number') {
 | 
			
		||||
              this.prerelease[i]++
 | 
			
		||||
              i = -2
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          if (i === -1) {
 | 
			
		||||
            // didn't increment anything
 | 
			
		||||
            if (identifier === this.prerelease.join('.') && identifierBase === false) {
 | 
			
		||||
              throw new Error('invalid increment argument: identifier already exists')
 | 
			
		||||
            }
 | 
			
		||||
            this.prerelease.push(base)
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        if (identifier) {
 | 
			
		||||
          // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
 | 
			
		||||
          // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
 | 
			
		||||
          let prerelease = [identifier, base]
 | 
			
		||||
          if (identifierBase === false) {
 | 
			
		||||
            prerelease = [identifier]
 | 
			
		||||
          }
 | 
			
		||||
          if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
 | 
			
		||||
            if (isNaN(this.prerelease[1])) {
 | 
			
		||||
              this.prerelease = prerelease
 | 
			
		||||
            }
 | 
			
		||||
          } else {
 | 
			
		||||
            this.prerelease = prerelease
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        break
 | 
			
		||||
      }
 | 
			
		||||
      default:
 | 
			
		||||
        throw new Error(`invalid increment argument: ${release}`)
 | 
			
		||||
    }
 | 
			
		||||
    this.raw = this.format()
 | 
			
		||||
    if (this.build.length) {
 | 
			
		||||
      this.raw += `+${this.build.join('.')}`
 | 
			
		||||
    }
 | 
			
		||||
    return this
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = SemVer
 | 
			
		||||
							
								
								
									
										8
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/clean.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/clean.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const parse = require('./parse')
 | 
			
		||||
const clean = (version, options) => {
 | 
			
		||||
  const s = parse(version.trim().replace(/^[=v]+/, ''), options)
 | 
			
		||||
  return s ? s.version : null
 | 
			
		||||
}
 | 
			
		||||
module.exports = clean
 | 
			
		||||
							
								
								
									
										54
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/cmp.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/cmp.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const eq = require('./eq')
 | 
			
		||||
const neq = require('./neq')
 | 
			
		||||
const gt = require('./gt')
 | 
			
		||||
const gte = require('./gte')
 | 
			
		||||
const lt = require('./lt')
 | 
			
		||||
const lte = require('./lte')
 | 
			
		||||
 | 
			
		||||
const cmp = (a, op, b, loose) => {
 | 
			
		||||
  switch (op) {
 | 
			
		||||
    case '===':
 | 
			
		||||
      if (typeof a === 'object') {
 | 
			
		||||
        a = a.version
 | 
			
		||||
      }
 | 
			
		||||
      if (typeof b === 'object') {
 | 
			
		||||
        b = b.version
 | 
			
		||||
      }
 | 
			
		||||
      return a === b
 | 
			
		||||
 | 
			
		||||
    case '!==':
 | 
			
		||||
      if (typeof a === 'object') {
 | 
			
		||||
        a = a.version
 | 
			
		||||
      }
 | 
			
		||||
      if (typeof b === 'object') {
 | 
			
		||||
        b = b.version
 | 
			
		||||
      }
 | 
			
		||||
      return a !== b
 | 
			
		||||
 | 
			
		||||
    case '':
 | 
			
		||||
    case '=':
 | 
			
		||||
    case '==':
 | 
			
		||||
      return eq(a, b, loose)
 | 
			
		||||
 | 
			
		||||
    case '!=':
 | 
			
		||||
      return neq(a, b, loose)
 | 
			
		||||
 | 
			
		||||
    case '>':
 | 
			
		||||
      return gt(a, b, loose)
 | 
			
		||||
 | 
			
		||||
    case '>=':
 | 
			
		||||
      return gte(a, b, loose)
 | 
			
		||||
 | 
			
		||||
    case '<':
 | 
			
		||||
      return lt(a, b, loose)
 | 
			
		||||
 | 
			
		||||
    case '<=':
 | 
			
		||||
      return lte(a, b, loose)
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
      throw new TypeError(`Invalid operator: ${op}`)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
module.exports = cmp
 | 
			
		||||
							
								
								
									
										62
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/coerce.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/coerce.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const parse = require('./parse')
 | 
			
		||||
const { safeRe: re, t } = require('../internal/re')
 | 
			
		||||
 | 
			
		||||
const coerce = (version, options) => {
 | 
			
		||||
  if (version instanceof SemVer) {
 | 
			
		||||
    return version
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (typeof version === 'number') {
 | 
			
		||||
    version = String(version)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (typeof version !== 'string') {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  options = options || {}
 | 
			
		||||
 | 
			
		||||
  let match = null
 | 
			
		||||
  if (!options.rtl) {
 | 
			
		||||
    match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])
 | 
			
		||||
  } else {
 | 
			
		||||
    // Find the right-most coercible string that does not share
 | 
			
		||||
    // a terminus with a more left-ward coercible string.
 | 
			
		||||
    // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
 | 
			
		||||
    // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
 | 
			
		||||
    //
 | 
			
		||||
    // Walk through the string checking with a /g regexp
 | 
			
		||||
    // Manually set the index so as to pick up overlapping matches.
 | 
			
		||||
    // Stop when we get a match that ends at the string end, since no
 | 
			
		||||
    // coercible string can be more right-ward without the same terminus.
 | 
			
		||||
    const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]
 | 
			
		||||
    let next
 | 
			
		||||
    while ((next = coerceRtlRegex.exec(version)) &&
 | 
			
		||||
        (!match || match.index + match[0].length !== version.length)
 | 
			
		||||
    ) {
 | 
			
		||||
      if (!match ||
 | 
			
		||||
            next.index + next[0].length !== match.index + match[0].length) {
 | 
			
		||||
        match = next
 | 
			
		||||
      }
 | 
			
		||||
      coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length
 | 
			
		||||
    }
 | 
			
		||||
    // leave it in a clean state
 | 
			
		||||
    coerceRtlRegex.lastIndex = -1
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (match === null) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const major = match[2]
 | 
			
		||||
  const minor = match[3] || '0'
 | 
			
		||||
  const patch = match[4] || '0'
 | 
			
		||||
  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''
 | 
			
		||||
  const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''
 | 
			
		||||
 | 
			
		||||
  return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
 | 
			
		||||
}
 | 
			
		||||
module.exports = coerce
 | 
			
		||||
							
								
								
									
										9
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/compare-build.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/compare-build.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const compareBuild = (a, b, loose) => {
 | 
			
		||||
  const versionA = new SemVer(a, loose)
 | 
			
		||||
  const versionB = new SemVer(b, loose)
 | 
			
		||||
  return versionA.compare(versionB) || versionA.compareBuild(versionB)
 | 
			
		||||
}
 | 
			
		||||
module.exports = compareBuild
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/compare-loose.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/compare-loose.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const compareLoose = (a, b) => compare(a, b, true)
 | 
			
		||||
module.exports = compareLoose
 | 
			
		||||
							
								
								
									
										7
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/compare.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/compare.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const compare = (a, b, loose) =>
 | 
			
		||||
  new SemVer(a, loose).compare(new SemVer(b, loose))
 | 
			
		||||
 | 
			
		||||
module.exports = compare
 | 
			
		||||
							
								
								
									
										60
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/diff.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/diff.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const parse = require('./parse.js')
 | 
			
		||||
 | 
			
		||||
const diff = (version1, version2) => {
 | 
			
		||||
  const v1 = parse(version1, null, true)
 | 
			
		||||
  const v2 = parse(version2, null, true)
 | 
			
		||||
  const comparison = v1.compare(v2)
 | 
			
		||||
 | 
			
		||||
  if (comparison === 0) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const v1Higher = comparison > 0
 | 
			
		||||
  const highVersion = v1Higher ? v1 : v2
 | 
			
		||||
  const lowVersion = v1Higher ? v2 : v1
 | 
			
		||||
  const highHasPre = !!highVersion.prerelease.length
 | 
			
		||||
  const lowHasPre = !!lowVersion.prerelease.length
 | 
			
		||||
 | 
			
		||||
  if (lowHasPre && !highHasPre) {
 | 
			
		||||
    // Going from prerelease -> no prerelease requires some special casing
 | 
			
		||||
 | 
			
		||||
    // If the low version has only a major, then it will always be a major
 | 
			
		||||
    // Some examples:
 | 
			
		||||
    // 1.0.0-1 -> 1.0.0
 | 
			
		||||
    // 1.0.0-1 -> 1.1.1
 | 
			
		||||
    // 1.0.0-1 -> 2.0.0
 | 
			
		||||
    if (!lowVersion.patch && !lowVersion.minor) {
 | 
			
		||||
      return 'major'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // If the main part has no difference
 | 
			
		||||
    if (lowVersion.compareMain(highVersion) === 0) {
 | 
			
		||||
      if (lowVersion.minor && !lowVersion.patch) {
 | 
			
		||||
        return 'minor'
 | 
			
		||||
      }
 | 
			
		||||
      return 'patch'
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // add the `pre` prefix if we are going to a prerelease version
 | 
			
		||||
  const prefix = highHasPre ? 'pre' : ''
 | 
			
		||||
 | 
			
		||||
  if (v1.major !== v2.major) {
 | 
			
		||||
    return prefix + 'major'
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (v1.minor !== v2.minor) {
 | 
			
		||||
    return prefix + 'minor'
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (v1.patch !== v2.patch) {
 | 
			
		||||
    return prefix + 'patch'
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // high and low are preleases
 | 
			
		||||
  return 'prerelease'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = diff
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/eq.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/eq.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
 | 
			
		||||
module.exports = eq
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/gt.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/gt.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const gt = (a, b, loose) => compare(a, b, loose) > 0
 | 
			
		||||
module.exports = gt
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/gte.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/gte.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const gte = (a, b, loose) => compare(a, b, loose) >= 0
 | 
			
		||||
module.exports = gte
 | 
			
		||||
							
								
								
									
										21
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/inc.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/inc.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
 | 
			
		||||
const inc = (version, release, options, identifier, identifierBase) => {
 | 
			
		||||
  if (typeof (options) === 'string') {
 | 
			
		||||
    identifierBase = identifier
 | 
			
		||||
    identifier = options
 | 
			
		||||
    options = undefined
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  try {
 | 
			
		||||
    return new SemVer(
 | 
			
		||||
      version instanceof SemVer ? version.version : version,
 | 
			
		||||
      options
 | 
			
		||||
    ).inc(release, identifier, identifierBase).version
 | 
			
		||||
  } catch (er) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
module.exports = inc
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/lt.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/lt.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const lt = (a, b, loose) => compare(a, b, loose) < 0
 | 
			
		||||
module.exports = lt
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/lte.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/lte.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const lte = (a, b, loose) => compare(a, b, loose) <= 0
 | 
			
		||||
module.exports = lte
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/major.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/major.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const major = (a, loose) => new SemVer(a, loose).major
 | 
			
		||||
module.exports = major
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/minor.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/minor.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const minor = (a, loose) => new SemVer(a, loose).minor
 | 
			
		||||
module.exports = minor
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/neq.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/neq.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
 | 
			
		||||
module.exports = neq
 | 
			
		||||
							
								
								
									
										18
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/parse.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/parse.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const parse = (version, options, throwErrors = false) => {
 | 
			
		||||
  if (version instanceof SemVer) {
 | 
			
		||||
    return version
 | 
			
		||||
  }
 | 
			
		||||
  try {
 | 
			
		||||
    return new SemVer(version, options)
 | 
			
		||||
  } catch (er) {
 | 
			
		||||
    if (!throwErrors) {
 | 
			
		||||
      return null
 | 
			
		||||
    }
 | 
			
		||||
    throw er
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = parse
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/patch.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/patch.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const patch = (a, loose) => new SemVer(a, loose).patch
 | 
			
		||||
module.exports = patch
 | 
			
		||||
							
								
								
									
										8
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/prerelease.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/prerelease.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const parse = require('./parse')
 | 
			
		||||
const prerelease = (version, options) => {
 | 
			
		||||
  const parsed = parse(version, options)
 | 
			
		||||
  return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
 | 
			
		||||
}
 | 
			
		||||
module.exports = prerelease
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/rcompare.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/rcompare.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compare = require('./compare')
 | 
			
		||||
const rcompare = (a, b, loose) => compare(b, a, loose)
 | 
			
		||||
module.exports = rcompare
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/rsort.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/rsort.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compareBuild = require('./compare-build')
 | 
			
		||||
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
 | 
			
		||||
module.exports = rsort
 | 
			
		||||
							
								
								
									
										12
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/satisfies.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/satisfies.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
const satisfies = (version, range, options) => {
 | 
			
		||||
  try {
 | 
			
		||||
    range = new Range(range, options)
 | 
			
		||||
  } catch (er) {
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
  return range.test(version)
 | 
			
		||||
}
 | 
			
		||||
module.exports = satisfies
 | 
			
		||||
							
								
								
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/sort.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/sort.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const compareBuild = require('./compare-build')
 | 
			
		||||
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
 | 
			
		||||
module.exports = sort
 | 
			
		||||
							
								
								
									
										8
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/valid.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/functions/valid.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const parse = require('./parse')
 | 
			
		||||
const valid = (version, options) => {
 | 
			
		||||
  const v = parse(version, options)
 | 
			
		||||
  return v ? v.version : null
 | 
			
		||||
}
 | 
			
		||||
module.exports = valid
 | 
			
		||||
							
								
								
									
										91
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,91 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// just pre-load all the stuff that index.js lazily exports
 | 
			
		||||
const internalRe = require('./internal/re')
 | 
			
		||||
const constants = require('./internal/constants')
 | 
			
		||||
const SemVer = require('./classes/semver')
 | 
			
		||||
const identifiers = require('./internal/identifiers')
 | 
			
		||||
const parse = require('./functions/parse')
 | 
			
		||||
const valid = require('./functions/valid')
 | 
			
		||||
const clean = require('./functions/clean')
 | 
			
		||||
const inc = require('./functions/inc')
 | 
			
		||||
const diff = require('./functions/diff')
 | 
			
		||||
const major = require('./functions/major')
 | 
			
		||||
const minor = require('./functions/minor')
 | 
			
		||||
const patch = require('./functions/patch')
 | 
			
		||||
const prerelease = require('./functions/prerelease')
 | 
			
		||||
const compare = require('./functions/compare')
 | 
			
		||||
const rcompare = require('./functions/rcompare')
 | 
			
		||||
const compareLoose = require('./functions/compare-loose')
 | 
			
		||||
const compareBuild = require('./functions/compare-build')
 | 
			
		||||
const sort = require('./functions/sort')
 | 
			
		||||
const rsort = require('./functions/rsort')
 | 
			
		||||
const gt = require('./functions/gt')
 | 
			
		||||
const lt = require('./functions/lt')
 | 
			
		||||
const eq = require('./functions/eq')
 | 
			
		||||
const neq = require('./functions/neq')
 | 
			
		||||
const gte = require('./functions/gte')
 | 
			
		||||
const lte = require('./functions/lte')
 | 
			
		||||
const cmp = require('./functions/cmp')
 | 
			
		||||
const coerce = require('./functions/coerce')
 | 
			
		||||
const Comparator = require('./classes/comparator')
 | 
			
		||||
const Range = require('./classes/range')
 | 
			
		||||
const satisfies = require('./functions/satisfies')
 | 
			
		||||
const toComparators = require('./ranges/to-comparators')
 | 
			
		||||
const maxSatisfying = require('./ranges/max-satisfying')
 | 
			
		||||
const minSatisfying = require('./ranges/min-satisfying')
 | 
			
		||||
const minVersion = require('./ranges/min-version')
 | 
			
		||||
const validRange = require('./ranges/valid')
 | 
			
		||||
const outside = require('./ranges/outside')
 | 
			
		||||
const gtr = require('./ranges/gtr')
 | 
			
		||||
const ltr = require('./ranges/ltr')
 | 
			
		||||
const intersects = require('./ranges/intersects')
 | 
			
		||||
const simplifyRange = require('./ranges/simplify')
 | 
			
		||||
const subset = require('./ranges/subset')
 | 
			
		||||
module.exports = {
 | 
			
		||||
  parse,
 | 
			
		||||
  valid,
 | 
			
		||||
  clean,
 | 
			
		||||
  inc,
 | 
			
		||||
  diff,
 | 
			
		||||
  major,
 | 
			
		||||
  minor,
 | 
			
		||||
  patch,
 | 
			
		||||
  prerelease,
 | 
			
		||||
  compare,
 | 
			
		||||
  rcompare,
 | 
			
		||||
  compareLoose,
 | 
			
		||||
  compareBuild,
 | 
			
		||||
  sort,
 | 
			
		||||
  rsort,
 | 
			
		||||
  gt,
 | 
			
		||||
  lt,
 | 
			
		||||
  eq,
 | 
			
		||||
  neq,
 | 
			
		||||
  gte,
 | 
			
		||||
  lte,
 | 
			
		||||
  cmp,
 | 
			
		||||
  coerce,
 | 
			
		||||
  Comparator,
 | 
			
		||||
  Range,
 | 
			
		||||
  satisfies,
 | 
			
		||||
  toComparators,
 | 
			
		||||
  maxSatisfying,
 | 
			
		||||
  minSatisfying,
 | 
			
		||||
  minVersion,
 | 
			
		||||
  validRange,
 | 
			
		||||
  outside,
 | 
			
		||||
  gtr,
 | 
			
		||||
  ltr,
 | 
			
		||||
  intersects,
 | 
			
		||||
  simplifyRange,
 | 
			
		||||
  subset,
 | 
			
		||||
  SemVer,
 | 
			
		||||
  re: internalRe.re,
 | 
			
		||||
  src: internalRe.src,
 | 
			
		||||
  tokens: internalRe.t,
 | 
			
		||||
  SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
 | 
			
		||||
  RELEASE_TYPES: constants.RELEASE_TYPES,
 | 
			
		||||
  compareIdentifiers: identifiers.compareIdentifiers,
 | 
			
		||||
  rcompareIdentifiers: identifiers.rcompareIdentifiers,
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/constants.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/constants.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// Note: this is the semver.org version of the spec that it implements
 | 
			
		||||
// Not necessarily the package version of this code.
 | 
			
		||||
const SEMVER_SPEC_VERSION = '2.0.0'
 | 
			
		||||
 | 
			
		||||
const MAX_LENGTH = 256
 | 
			
		||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
 | 
			
		||||
/* istanbul ignore next */ 9007199254740991
 | 
			
		||||
 | 
			
		||||
// Max safe segment length for coercion.
 | 
			
		||||
const MAX_SAFE_COMPONENT_LENGTH = 16
 | 
			
		||||
 | 
			
		||||
// Max safe length for a build identifier. The max length minus 6 characters for
 | 
			
		||||
// the shortest version with a build 0.0.0+BUILD.
 | 
			
		||||
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
 | 
			
		||||
 | 
			
		||||
const RELEASE_TYPES = [
 | 
			
		||||
  'major',
 | 
			
		||||
  'premajor',
 | 
			
		||||
  'minor',
 | 
			
		||||
  'preminor',
 | 
			
		||||
  'patch',
 | 
			
		||||
  'prepatch',
 | 
			
		||||
  'prerelease',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  MAX_LENGTH,
 | 
			
		||||
  MAX_SAFE_COMPONENT_LENGTH,
 | 
			
		||||
  MAX_SAFE_BUILD_LENGTH,
 | 
			
		||||
  MAX_SAFE_INTEGER,
 | 
			
		||||
  RELEASE_TYPES,
 | 
			
		||||
  SEMVER_SPEC_VERSION,
 | 
			
		||||
  FLAG_INCLUDE_PRERELEASE: 0b001,
 | 
			
		||||
  FLAG_LOOSE: 0b010,
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/debug.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const debug = (
 | 
			
		||||
  typeof process === 'object' &&
 | 
			
		||||
  process.env &&
 | 
			
		||||
  process.env.NODE_DEBUG &&
 | 
			
		||||
  /\bsemver\b/i.test(process.env.NODE_DEBUG)
 | 
			
		||||
) ? (...args) => console.error('SEMVER', ...args)
 | 
			
		||||
  : () => {}
 | 
			
		||||
 | 
			
		||||
module.exports = debug
 | 
			
		||||
							
								
								
									
										29
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/identifiers.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/identifiers.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const numeric = /^[0-9]+$/
 | 
			
		||||
const compareIdentifiers = (a, b) => {
 | 
			
		||||
  if (typeof a === 'number' && typeof b === 'number') {
 | 
			
		||||
    return a === b ? 0 : a < b ? -1 : 1
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const anum = numeric.test(a)
 | 
			
		||||
  const bnum = numeric.test(b)
 | 
			
		||||
 | 
			
		||||
  if (anum && bnum) {
 | 
			
		||||
    a = +a
 | 
			
		||||
    b = +b
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return a === b ? 0
 | 
			
		||||
    : (anum && !bnum) ? -1
 | 
			
		||||
    : (bnum && !anum) ? 1
 | 
			
		||||
    : a < b ? -1
 | 
			
		||||
    : 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  compareIdentifiers,
 | 
			
		||||
  rcompareIdentifiers,
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/lrucache.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/lrucache.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
class LRUCache {
 | 
			
		||||
  constructor () {
 | 
			
		||||
    this.max = 1000
 | 
			
		||||
    this.map = new Map()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get (key) {
 | 
			
		||||
    const value = this.map.get(key)
 | 
			
		||||
    if (value === undefined) {
 | 
			
		||||
      return undefined
 | 
			
		||||
    } else {
 | 
			
		||||
      // Remove the key from the map and add it to the end
 | 
			
		||||
      this.map.delete(key)
 | 
			
		||||
      this.map.set(key, value)
 | 
			
		||||
      return value
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  delete (key) {
 | 
			
		||||
    return this.map.delete(key)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set (key, value) {
 | 
			
		||||
    const deleted = this.delete(key)
 | 
			
		||||
 | 
			
		||||
    if (!deleted && value !== undefined) {
 | 
			
		||||
      // If cache is full, delete the least recently used item
 | 
			
		||||
      if (this.map.size >= this.max) {
 | 
			
		||||
        const firstKey = this.map.keys().next().value
 | 
			
		||||
        this.delete(firstKey)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.map.set(key, value)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return this
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = LRUCache
 | 
			
		||||
							
								
								
									
										17
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/parse-options.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/parse-options.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// parse out just the options we care about
 | 
			
		||||
const looseOption = Object.freeze({ loose: true })
 | 
			
		||||
const emptyOpts = Object.freeze({ })
 | 
			
		||||
const parseOptions = options => {
 | 
			
		||||
  if (!options) {
 | 
			
		||||
    return emptyOpts
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (typeof options !== 'object') {
 | 
			
		||||
    return looseOption
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return options
 | 
			
		||||
}
 | 
			
		||||
module.exports = parseOptions
 | 
			
		||||
							
								
								
									
										223
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/re.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										223
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/internal/re.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,223 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const {
 | 
			
		||||
  MAX_SAFE_COMPONENT_LENGTH,
 | 
			
		||||
  MAX_SAFE_BUILD_LENGTH,
 | 
			
		||||
  MAX_LENGTH,
 | 
			
		||||
} = require('./constants')
 | 
			
		||||
const debug = require('./debug')
 | 
			
		||||
exports = module.exports = {}
 | 
			
		||||
 | 
			
		||||
// The actual regexps go on exports.re
 | 
			
		||||
const re = exports.re = []
 | 
			
		||||
const safeRe = exports.safeRe = []
 | 
			
		||||
const src = exports.src = []
 | 
			
		||||
const safeSrc = exports.safeSrc = []
 | 
			
		||||
const t = exports.t = {}
 | 
			
		||||
let R = 0
 | 
			
		||||
 | 
			
		||||
const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
 | 
			
		||||
 | 
			
		||||
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
 | 
			
		||||
// used internally via the safeRe object since all inputs in this library get
 | 
			
		||||
// normalized first to trim and collapse all extra whitespace. The original
 | 
			
		||||
// regexes are exported for userland consumption and lower level usage. A
 | 
			
		||||
// future breaking change could export the safer regex only with a note that
 | 
			
		||||
// all input should have extra whitespace removed.
 | 
			
		||||
const safeRegexReplacements = [
 | 
			
		||||
  ['\\s', 1],
 | 
			
		||||
  ['\\d', MAX_LENGTH],
 | 
			
		||||
  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
const makeSafeRegex = (value) => {
 | 
			
		||||
  for (const [token, max] of safeRegexReplacements) {
 | 
			
		||||
    value = value
 | 
			
		||||
      .split(`${token}*`).join(`${token}{0,${max}}`)
 | 
			
		||||
      .split(`${token}+`).join(`${token}{1,${max}}`)
 | 
			
		||||
  }
 | 
			
		||||
  return value
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const createToken = (name, value, isGlobal) => {
 | 
			
		||||
  const safe = makeSafeRegex(value)
 | 
			
		||||
  const index = R++
 | 
			
		||||
  debug(name, index, value)
 | 
			
		||||
  t[name] = index
 | 
			
		||||
  src[index] = value
 | 
			
		||||
  safeSrc[index] = safe
 | 
			
		||||
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
 | 
			
		||||
  safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// The following Regular Expressions can be used for tokenizing,
 | 
			
		||||
// validating, and parsing SemVer version strings.
 | 
			
		||||
 | 
			
		||||
// ## Numeric Identifier
 | 
			
		||||
// A single `0`, or a non-zero digit followed by zero or more digits.
 | 
			
		||||
 | 
			
		||||
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
 | 
			
		||||
createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
 | 
			
		||||
 | 
			
		||||
// ## Non-numeric Identifier
 | 
			
		||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
 | 
			
		||||
// more letters, digits, or hyphens.
 | 
			
		||||
 | 
			
		||||
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
 | 
			
		||||
 | 
			
		||||
// ## Main Version
 | 
			
		||||
// Three dot-separated numeric identifiers.
 | 
			
		||||
 | 
			
		||||
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
 | 
			
		||||
                   `(${src[t.NUMERICIDENTIFIER]})\\.` +
 | 
			
		||||
                   `(${src[t.NUMERICIDENTIFIER]})`)
 | 
			
		||||
 | 
			
		||||
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
 | 
			
		||||
                        `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
 | 
			
		||||
                        `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
 | 
			
		||||
 | 
			
		||||
// ## Pre-release Version Identifier
 | 
			
		||||
// A numeric identifier, or a non-numeric identifier.
 | 
			
		||||
// Non-numberic identifiers include numberic identifiers but can be longer.
 | 
			
		||||
// Therefore non-numberic identifiers must go first.
 | 
			
		||||
 | 
			
		||||
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
 | 
			
		||||
}|${src[t.NUMERICIDENTIFIER]})`)
 | 
			
		||||
 | 
			
		||||
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
 | 
			
		||||
}|${src[t.NUMERICIDENTIFIERLOOSE]})`)
 | 
			
		||||
 | 
			
		||||
// ## Pre-release Version
 | 
			
		||||
// Hyphen, followed by one or more dot-separated pre-release version
 | 
			
		||||
// identifiers.
 | 
			
		||||
 | 
			
		||||
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
 | 
			
		||||
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
 | 
			
		||||
 | 
			
		||||
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
 | 
			
		||||
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
 | 
			
		||||
 | 
			
		||||
// ## Build Metadata Identifier
 | 
			
		||||
// Any combination of digits, letters, or hyphens.
 | 
			
		||||
 | 
			
		||||
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
 | 
			
		||||
 | 
			
		||||
// ## Build Metadata
 | 
			
		||||
// Plus sign, followed by one or more period-separated build metadata
 | 
			
		||||
// identifiers.
 | 
			
		||||
 | 
			
		||||
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
 | 
			
		||||
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
 | 
			
		||||
 | 
			
		||||
// ## Full Version String
 | 
			
		||||
// A main version, followed optionally by a pre-release version and
 | 
			
		||||
// build metadata.
 | 
			
		||||
 | 
			
		||||
// Note that the only major, minor, patch, and pre-release sections of
 | 
			
		||||
// the version string are capturing groups.  The build metadata is not a
 | 
			
		||||
// capturing group, because it should not ever be used in version
 | 
			
		||||
// comparison.
 | 
			
		||||
 | 
			
		||||
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
 | 
			
		||||
}${src[t.PRERELEASE]}?${
 | 
			
		||||
  src[t.BUILD]}?`)
 | 
			
		||||
 | 
			
		||||
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
 | 
			
		||||
 | 
			
		||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
 | 
			
		||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
 | 
			
		||||
// common in the npm registry.
 | 
			
		||||
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
 | 
			
		||||
}${src[t.PRERELEASELOOSE]}?${
 | 
			
		||||
  src[t.BUILD]}?`)
 | 
			
		||||
 | 
			
		||||
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
 | 
			
		||||
 | 
			
		||||
createToken('GTLT', '((?:<|>)?=?)')
 | 
			
		||||
 | 
			
		||||
// Something like "2.*" or "1.2.x".
 | 
			
		||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
 | 
			
		||||
// Only the first item is strictly required.
 | 
			
		||||
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
 | 
			
		||||
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
 | 
			
		||||
 | 
			
		||||
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
 | 
			
		||||
                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
 | 
			
		||||
                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
 | 
			
		||||
                   `(?:${src[t.PRERELEASE]})?${
 | 
			
		||||
                     src[t.BUILD]}?` +
 | 
			
		||||
                   `)?)?`)
 | 
			
		||||
 | 
			
		||||
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
 | 
			
		||||
                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
 | 
			
		||||
                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
 | 
			
		||||
                        `(?:${src[t.PRERELEASELOOSE]})?${
 | 
			
		||||
                          src[t.BUILD]}?` +
 | 
			
		||||
                        `)?)?`)
 | 
			
		||||
 | 
			
		||||
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
 | 
			
		||||
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
 | 
			
		||||
 | 
			
		||||
// Coercion.
 | 
			
		||||
// Extract anything that could conceivably be a part of a valid semver
 | 
			
		||||
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
 | 
			
		||||
              '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
 | 
			
		||||
              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
 | 
			
		||||
              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
 | 
			
		||||
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
 | 
			
		||||
createToken('COERCEFULL', src[t.COERCEPLAIN] +
 | 
			
		||||
              `(?:${src[t.PRERELEASE]})?` +
 | 
			
		||||
              `(?:${src[t.BUILD]})?` +
 | 
			
		||||
              `(?:$|[^\\d])`)
 | 
			
		||||
createToken('COERCERTL', src[t.COERCE], true)
 | 
			
		||||
createToken('COERCERTLFULL', src[t.COERCEFULL], true)
 | 
			
		||||
 | 
			
		||||
// Tilde ranges.
 | 
			
		||||
// Meaning is "reasonably at or greater than"
 | 
			
		||||
createToken('LONETILDE', '(?:~>?)')
 | 
			
		||||
 | 
			
		||||
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
 | 
			
		||||
exports.tildeTrimReplace = '$1~'
 | 
			
		||||
 | 
			
		||||
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
 | 
			
		||||
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
 | 
			
		||||
 | 
			
		||||
// Caret ranges.
 | 
			
		||||
// Meaning is "at least and backwards compatible with"
 | 
			
		||||
createToken('LONECARET', '(?:\\^)')
 | 
			
		||||
 | 
			
		||||
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
 | 
			
		||||
exports.caretTrimReplace = '$1^'
 | 
			
		||||
 | 
			
		||||
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
 | 
			
		||||
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
 | 
			
		||||
 | 
			
		||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
 | 
			
		||||
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
 | 
			
		||||
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
 | 
			
		||||
 | 
			
		||||
// An expression to strip any whitespace between the gtlt and the thing
 | 
			
		||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
 | 
			
		||||
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
 | 
			
		||||
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
 | 
			
		||||
exports.comparatorTrimReplace = '$1$2$3'
 | 
			
		||||
 | 
			
		||||
// Something like `1.2.3 - 1.2.4`
 | 
			
		||||
// Note that these all use the loose form, because they'll be
 | 
			
		||||
// checked against either the strict or loose comparator form
 | 
			
		||||
// later.
 | 
			
		||||
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
 | 
			
		||||
                   `\\s+-\\s+` +
 | 
			
		||||
                   `(${src[t.XRANGEPLAIN]})` +
 | 
			
		||||
                   `\\s*$`)
 | 
			
		||||
 | 
			
		||||
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
 | 
			
		||||
                        `\\s+-\\s+` +
 | 
			
		||||
                        `(${src[t.XRANGEPLAINLOOSE]})` +
 | 
			
		||||
                        `\\s*$`)
 | 
			
		||||
 | 
			
		||||
// Star ranges basically just allow anything at all.
 | 
			
		||||
createToken('STAR', '(<|>)?=?\\s*\\*')
 | 
			
		||||
// >=0.0.0 is like a star
 | 
			
		||||
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
 | 
			
		||||
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
 | 
			
		||||
							
								
								
									
										78
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "semver",
 | 
			
		||||
  "version": "7.7.3",
 | 
			
		||||
  "description": "The semantic version parser used by npm.",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "tap",
 | 
			
		||||
    "snap": "tap",
 | 
			
		||||
    "lint": "npm run eslint",
 | 
			
		||||
    "postlint": "template-oss-check",
 | 
			
		||||
    "lintfix": "npm run eslint -- --fix",
 | 
			
		||||
    "posttest": "npm run lint",
 | 
			
		||||
    "template-oss-apply": "template-oss-apply --force",
 | 
			
		||||
    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@npmcli/eslint-config": "^5.0.0",
 | 
			
		||||
    "@npmcli/template-oss": "4.25.1",
 | 
			
		||||
    "benchmark": "^2.1.4",
 | 
			
		||||
    "tap": "^16.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/npm/node-semver.git"
 | 
			
		||||
  },
 | 
			
		||||
  "bin": {
 | 
			
		||||
    "semver": "bin/semver.js"
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "bin/",
 | 
			
		||||
    "lib/",
 | 
			
		||||
    "classes/",
 | 
			
		||||
    "functions/",
 | 
			
		||||
    "internal/",
 | 
			
		||||
    "ranges/",
 | 
			
		||||
    "index.js",
 | 
			
		||||
    "preload.js",
 | 
			
		||||
    "range.bnf"
 | 
			
		||||
  ],
 | 
			
		||||
  "tap": {
 | 
			
		||||
    "timeout": 30,
 | 
			
		||||
    "coverage-map": "map.js",
 | 
			
		||||
    "nyc-arg": [
 | 
			
		||||
      "--exclude",
 | 
			
		||||
      "tap-snapshots/**"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=10"
 | 
			
		||||
  },
 | 
			
		||||
  "author": "GitHub Inc.",
 | 
			
		||||
  "templateOSS": {
 | 
			
		||||
    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
 | 
			
		||||
    "version": "4.25.1",
 | 
			
		||||
    "engines": ">=10",
 | 
			
		||||
    "distPaths": [
 | 
			
		||||
      "classes/",
 | 
			
		||||
      "functions/",
 | 
			
		||||
      "internal/",
 | 
			
		||||
      "ranges/",
 | 
			
		||||
      "index.js",
 | 
			
		||||
      "preload.js",
 | 
			
		||||
      "range.bnf"
 | 
			
		||||
    ],
 | 
			
		||||
    "allowPaths": [
 | 
			
		||||
      "/classes/",
 | 
			
		||||
      "/functions/",
 | 
			
		||||
      "/internal/",
 | 
			
		||||
      "/ranges/",
 | 
			
		||||
      "/index.js",
 | 
			
		||||
      "/preload.js",
 | 
			
		||||
      "/range.bnf",
 | 
			
		||||
      "/benchmarks"
 | 
			
		||||
    ],
 | 
			
		||||
    "publish": "true"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/preload.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/preload.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// XXX remove in v8 or beyond
 | 
			
		||||
module.exports = require('./index.js')
 | 
			
		||||
							
								
								
									
										16
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/range.bnf
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/range.bnf
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
range-set  ::= range ( logical-or range ) *
 | 
			
		||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
 | 
			
		||||
range      ::= hyphen | simple ( ' ' simple ) * | ''
 | 
			
		||||
hyphen     ::= partial ' - ' partial
 | 
			
		||||
simple     ::= primitive | partial | tilde | caret
 | 
			
		||||
primitive  ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
 | 
			
		||||
partial    ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
 | 
			
		||||
xr         ::= 'x' | 'X' | '*' | nr
 | 
			
		||||
nr         ::= '0' | [1-9] ( [0-9] ) *
 | 
			
		||||
tilde      ::= '~' partial
 | 
			
		||||
caret      ::= '^' partial
 | 
			
		||||
qualifier  ::= ( '-' pre )? ( '+' build )?
 | 
			
		||||
pre        ::= parts
 | 
			
		||||
build      ::= parts
 | 
			
		||||
parts      ::= part ( '.' part ) *
 | 
			
		||||
part       ::= nr | [-0-9A-Za-z]+
 | 
			
		||||
							
								
								
									
										6
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/gtr.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/gtr.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// Determine if version is greater than all the versions possible in the range.
 | 
			
		||||
const outside = require('./outside')
 | 
			
		||||
const gtr = (version, range, options) => outside(version, range, '>', options)
 | 
			
		||||
module.exports = gtr
 | 
			
		||||
							
								
								
									
										9
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/intersects.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/intersects.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
const intersects = (r1, r2, options) => {
 | 
			
		||||
  r1 = new Range(r1, options)
 | 
			
		||||
  r2 = new Range(r2, options)
 | 
			
		||||
  return r1.intersects(r2, options)
 | 
			
		||||
}
 | 
			
		||||
module.exports = intersects
 | 
			
		||||
							
								
								
									
										6
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/ltr.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/ltr.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const outside = require('./outside')
 | 
			
		||||
// Determine if version is less than all the versions possible in the range
 | 
			
		||||
const ltr = (version, range, options) => outside(version, range, '<', options)
 | 
			
		||||
module.exports = ltr
 | 
			
		||||
							
								
								
									
										27
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/max-satisfying.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/max-satisfying.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
 | 
			
		||||
const maxSatisfying = (versions, range, options) => {
 | 
			
		||||
  let max = null
 | 
			
		||||
  let maxSV = null
 | 
			
		||||
  let rangeObj = null
 | 
			
		||||
  try {
 | 
			
		||||
    rangeObj = new Range(range, options)
 | 
			
		||||
  } catch (er) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
  versions.forEach((v) => {
 | 
			
		||||
    if (rangeObj.test(v)) {
 | 
			
		||||
      // satisfies(v, range, options)
 | 
			
		||||
      if (!max || maxSV.compare(v) === -1) {
 | 
			
		||||
        // compare(max, v, true)
 | 
			
		||||
        max = v
 | 
			
		||||
        maxSV = new SemVer(max, options)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
  return max
 | 
			
		||||
}
 | 
			
		||||
module.exports = maxSatisfying
 | 
			
		||||
							
								
								
									
										26
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/min-satisfying.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/min-satisfying.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
const minSatisfying = (versions, range, options) => {
 | 
			
		||||
  let min = null
 | 
			
		||||
  let minSV = null
 | 
			
		||||
  let rangeObj = null
 | 
			
		||||
  try {
 | 
			
		||||
    rangeObj = new Range(range, options)
 | 
			
		||||
  } catch (er) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
  versions.forEach((v) => {
 | 
			
		||||
    if (rangeObj.test(v)) {
 | 
			
		||||
      // satisfies(v, range, options)
 | 
			
		||||
      if (!min || minSV.compare(v) === 1) {
 | 
			
		||||
        // compare(min, v, true)
 | 
			
		||||
        min = v
 | 
			
		||||
        minSV = new SemVer(min, options)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
  return min
 | 
			
		||||
}
 | 
			
		||||
module.exports = minSatisfying
 | 
			
		||||
							
								
								
									
										63
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/min-version.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/min-version.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,63 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
const gt = require('../functions/gt')
 | 
			
		||||
 | 
			
		||||
const minVersion = (range, loose) => {
 | 
			
		||||
  range = new Range(range, loose)
 | 
			
		||||
 | 
			
		||||
  let minver = new SemVer('0.0.0')
 | 
			
		||||
  if (range.test(minver)) {
 | 
			
		||||
    return minver
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  minver = new SemVer('0.0.0-0')
 | 
			
		||||
  if (range.test(minver)) {
 | 
			
		||||
    return minver
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  minver = null
 | 
			
		||||
  for (let i = 0; i < range.set.length; ++i) {
 | 
			
		||||
    const comparators = range.set[i]
 | 
			
		||||
 | 
			
		||||
    let setMin = null
 | 
			
		||||
    comparators.forEach((comparator) => {
 | 
			
		||||
      // Clone to avoid manipulating the comparator's semver object.
 | 
			
		||||
      const compver = new SemVer(comparator.semver.version)
 | 
			
		||||
      switch (comparator.operator) {
 | 
			
		||||
        case '>':
 | 
			
		||||
          if (compver.prerelease.length === 0) {
 | 
			
		||||
            compver.patch++
 | 
			
		||||
          } else {
 | 
			
		||||
            compver.prerelease.push(0)
 | 
			
		||||
          }
 | 
			
		||||
          compver.raw = compver.format()
 | 
			
		||||
          /* fallthrough */
 | 
			
		||||
        case '':
 | 
			
		||||
        case '>=':
 | 
			
		||||
          if (!setMin || gt(compver, setMin)) {
 | 
			
		||||
            setMin = compver
 | 
			
		||||
          }
 | 
			
		||||
          break
 | 
			
		||||
        case '<':
 | 
			
		||||
        case '<=':
 | 
			
		||||
          /* Ignore maximum versions */
 | 
			
		||||
          break
 | 
			
		||||
        /* istanbul ignore next */
 | 
			
		||||
        default:
 | 
			
		||||
          throw new Error(`Unexpected operation: ${comparator.operator}`)
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
    if (setMin && (!minver || gt(minver, setMin))) {
 | 
			
		||||
      minver = setMin
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (minver && range.test(minver)) {
 | 
			
		||||
    return minver
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return null
 | 
			
		||||
}
 | 
			
		||||
module.exports = minVersion
 | 
			
		||||
							
								
								
									
										82
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/outside.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/outside.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const SemVer = require('../classes/semver')
 | 
			
		||||
const Comparator = require('../classes/comparator')
 | 
			
		||||
const { ANY } = Comparator
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
const satisfies = require('../functions/satisfies')
 | 
			
		||||
const gt = require('../functions/gt')
 | 
			
		||||
const lt = require('../functions/lt')
 | 
			
		||||
const lte = require('../functions/lte')
 | 
			
		||||
const gte = require('../functions/gte')
 | 
			
		||||
 | 
			
		||||
const outside = (version, range, hilo, options) => {
 | 
			
		||||
  version = new SemVer(version, options)
 | 
			
		||||
  range = new Range(range, options)
 | 
			
		||||
 | 
			
		||||
  let gtfn, ltefn, ltfn, comp, ecomp
 | 
			
		||||
  switch (hilo) {
 | 
			
		||||
    case '>':
 | 
			
		||||
      gtfn = gt
 | 
			
		||||
      ltefn = lte
 | 
			
		||||
      ltfn = lt
 | 
			
		||||
      comp = '>'
 | 
			
		||||
      ecomp = '>='
 | 
			
		||||
      break
 | 
			
		||||
    case '<':
 | 
			
		||||
      gtfn = lt
 | 
			
		||||
      ltefn = gte
 | 
			
		||||
      ltfn = gt
 | 
			
		||||
      comp = '<'
 | 
			
		||||
      ecomp = '<='
 | 
			
		||||
      break
 | 
			
		||||
    default:
 | 
			
		||||
      throw new TypeError('Must provide a hilo val of "<" or ">"')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // If it satisfies the range it is not outside
 | 
			
		||||
  if (satisfies(version, range, options)) {
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // From now on, variable terms are as if we're in "gtr" mode.
 | 
			
		||||
  // but note that everything is flipped for the "ltr" function.
 | 
			
		||||
 | 
			
		||||
  for (let i = 0; i < range.set.length; ++i) {
 | 
			
		||||
    const comparators = range.set[i]
 | 
			
		||||
 | 
			
		||||
    let high = null
 | 
			
		||||
    let low = null
 | 
			
		||||
 | 
			
		||||
    comparators.forEach((comparator) => {
 | 
			
		||||
      if (comparator.semver === ANY) {
 | 
			
		||||
        comparator = new Comparator('>=0.0.0')
 | 
			
		||||
      }
 | 
			
		||||
      high = high || comparator
 | 
			
		||||
      low = low || comparator
 | 
			
		||||
      if (gtfn(comparator.semver, high.semver, options)) {
 | 
			
		||||
        high = comparator
 | 
			
		||||
      } else if (ltfn(comparator.semver, low.semver, options)) {
 | 
			
		||||
        low = comparator
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    // If the edge version comparator has a operator then our version
 | 
			
		||||
    // isn't outside it
 | 
			
		||||
    if (high.operator === comp || high.operator === ecomp) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // If the lowest version comparator has an operator and our version
 | 
			
		||||
    // is less than it then it isn't higher than the range
 | 
			
		||||
    if ((!low.operator || low.operator === comp) &&
 | 
			
		||||
        ltefn(version, low.semver)) {
 | 
			
		||||
      return false
 | 
			
		||||
    } else if (low.operator === ecomp && ltfn(version, low.semver)) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = outside
 | 
			
		||||
							
								
								
									
										49
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/simplify.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/simplify.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// given a set of versions and a range, create a "simplified" range
 | 
			
		||||
// that includes the same versions that the original range does
 | 
			
		||||
// If the original range is shorter than the simplified one, return that.
 | 
			
		||||
const satisfies = require('../functions/satisfies.js')
 | 
			
		||||
const compare = require('../functions/compare.js')
 | 
			
		||||
module.exports = (versions, range, options) => {
 | 
			
		||||
  const set = []
 | 
			
		||||
  let first = null
 | 
			
		||||
  let prev = null
 | 
			
		||||
  const v = versions.sort((a, b) => compare(a, b, options))
 | 
			
		||||
  for (const version of v) {
 | 
			
		||||
    const included = satisfies(version, range, options)
 | 
			
		||||
    if (included) {
 | 
			
		||||
      prev = version
 | 
			
		||||
      if (!first) {
 | 
			
		||||
        first = version
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      if (prev) {
 | 
			
		||||
        set.push([first, prev])
 | 
			
		||||
      }
 | 
			
		||||
      prev = null
 | 
			
		||||
      first = null
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (first) {
 | 
			
		||||
    set.push([first, null])
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const ranges = []
 | 
			
		||||
  for (const [min, max] of set) {
 | 
			
		||||
    if (min === max) {
 | 
			
		||||
      ranges.push(min)
 | 
			
		||||
    } else if (!max && min === v[0]) {
 | 
			
		||||
      ranges.push('*')
 | 
			
		||||
    } else if (!max) {
 | 
			
		||||
      ranges.push(`>=${min}`)
 | 
			
		||||
    } else if (min === v[0]) {
 | 
			
		||||
      ranges.push(`<=${max}`)
 | 
			
		||||
    } else {
 | 
			
		||||
      ranges.push(`${min} - ${max}`)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  const simplified = ranges.join(' || ')
 | 
			
		||||
  const original = typeof range.raw === 'string' ? range.raw : String(range)
 | 
			
		||||
  return simplified.length < original.length ? simplified : range
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										249
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/subset.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										249
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/subset.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,249 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const Range = require('../classes/range.js')
 | 
			
		||||
const Comparator = require('../classes/comparator.js')
 | 
			
		||||
const { ANY } = Comparator
 | 
			
		||||
const satisfies = require('../functions/satisfies.js')
 | 
			
		||||
const compare = require('../functions/compare.js')
 | 
			
		||||
 | 
			
		||||
// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
 | 
			
		||||
// - Every simple range `r1, r2, ...` is a null set, OR
 | 
			
		||||
// - Every simple range `r1, r2, ...` which is not a null set is a subset of
 | 
			
		||||
//   some `R1, R2, ...`
 | 
			
		||||
//
 | 
			
		||||
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
 | 
			
		||||
// - If c is only the ANY comparator
 | 
			
		||||
//   - If C is only the ANY comparator, return true
 | 
			
		||||
//   - Else if in prerelease mode, return false
 | 
			
		||||
//   - else replace c with `[>=0.0.0]`
 | 
			
		||||
// - If C is only the ANY comparator
 | 
			
		||||
//   - if in prerelease mode, return true
 | 
			
		||||
//   - else replace C with `[>=0.0.0]`
 | 
			
		||||
// - Let EQ be the set of = comparators in c
 | 
			
		||||
// - If EQ is more than one, return true (null set)
 | 
			
		||||
// - Let GT be the highest > or >= comparator in c
 | 
			
		||||
// - Let LT be the lowest < or <= comparator in c
 | 
			
		||||
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
 | 
			
		||||
// - If any C is a = range, and GT or LT are set, return false
 | 
			
		||||
// - If EQ
 | 
			
		||||
//   - If GT, and EQ does not satisfy GT, return true (null set)
 | 
			
		||||
//   - If LT, and EQ does not satisfy LT, return true (null set)
 | 
			
		||||
//   - If EQ satisfies every C, return true
 | 
			
		||||
//   - Else return false
 | 
			
		||||
// - If GT
 | 
			
		||||
//   - If GT.semver is lower than any > or >= comp in C, return false
 | 
			
		||||
//   - If GT is >=, and GT.semver does not satisfy every C, return false
 | 
			
		||||
//   - If GT.semver has a prerelease, and not in prerelease mode
 | 
			
		||||
//     - If no C has a prerelease and the GT.semver tuple, return false
 | 
			
		||||
// - If LT
 | 
			
		||||
//   - If LT.semver is greater than any < or <= comp in C, return false
 | 
			
		||||
//   - If LT is <=, and LT.semver does not satisfy every C, return false
 | 
			
		||||
//   - If GT.semver has a prerelease, and not in prerelease mode
 | 
			
		||||
//     - If no C has a prerelease and the LT.semver tuple, return false
 | 
			
		||||
// - Else return true
 | 
			
		||||
 | 
			
		||||
const subset = (sub, dom, options = {}) => {
 | 
			
		||||
  if (sub === dom) {
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  sub = new Range(sub, options)
 | 
			
		||||
  dom = new Range(dom, options)
 | 
			
		||||
  let sawNonNull = false
 | 
			
		||||
 | 
			
		||||
  OUTER: for (const simpleSub of sub.set) {
 | 
			
		||||
    for (const simpleDom of dom.set) {
 | 
			
		||||
      const isSub = simpleSubset(simpleSub, simpleDom, options)
 | 
			
		||||
      sawNonNull = sawNonNull || isSub !== null
 | 
			
		||||
      if (isSub) {
 | 
			
		||||
        continue OUTER
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // the null set is a subset of everything, but null simple ranges in
 | 
			
		||||
    // a complex range should be ignored.  so if we saw a non-null range,
 | 
			
		||||
    // then we know this isn't a subset, but if EVERY simple range was null,
 | 
			
		||||
    // then it is a subset.
 | 
			
		||||
    if (sawNonNull) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
 | 
			
		||||
const minimumVersion = [new Comparator('>=0.0.0')]
 | 
			
		||||
 | 
			
		||||
const simpleSubset = (sub, dom, options) => {
 | 
			
		||||
  if (sub === dom) {
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (sub.length === 1 && sub[0].semver === ANY) {
 | 
			
		||||
    if (dom.length === 1 && dom[0].semver === ANY) {
 | 
			
		||||
      return true
 | 
			
		||||
    } else if (options.includePrerelease) {
 | 
			
		||||
      sub = minimumVersionWithPreRelease
 | 
			
		||||
    } else {
 | 
			
		||||
      sub = minimumVersion
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (dom.length === 1 && dom[0].semver === ANY) {
 | 
			
		||||
    if (options.includePrerelease) {
 | 
			
		||||
      return true
 | 
			
		||||
    } else {
 | 
			
		||||
      dom = minimumVersion
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const eqSet = new Set()
 | 
			
		||||
  let gt, lt
 | 
			
		||||
  for (const c of sub) {
 | 
			
		||||
    if (c.operator === '>' || c.operator === '>=') {
 | 
			
		||||
      gt = higherGT(gt, c, options)
 | 
			
		||||
    } else if (c.operator === '<' || c.operator === '<=') {
 | 
			
		||||
      lt = lowerLT(lt, c, options)
 | 
			
		||||
    } else {
 | 
			
		||||
      eqSet.add(c.semver)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (eqSet.size > 1) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  let gtltComp
 | 
			
		||||
  if (gt && lt) {
 | 
			
		||||
    gtltComp = compare(gt.semver, lt.semver, options)
 | 
			
		||||
    if (gtltComp > 0) {
 | 
			
		||||
      return null
 | 
			
		||||
    } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
 | 
			
		||||
      return null
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // will iterate one or zero times
 | 
			
		||||
  for (const eq of eqSet) {
 | 
			
		||||
    if (gt && !satisfies(eq, String(gt), options)) {
 | 
			
		||||
      return null
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (lt && !satisfies(eq, String(lt), options)) {
 | 
			
		||||
      return null
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (const c of dom) {
 | 
			
		||||
      if (!satisfies(eq, String(c), options)) {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  let higher, lower
 | 
			
		||||
  let hasDomLT, hasDomGT
 | 
			
		||||
  // if the subset has a prerelease, we need a comparator in the superset
 | 
			
		||||
  // with the same tuple and a prerelease, or it's not a subset
 | 
			
		||||
  let needDomLTPre = lt &&
 | 
			
		||||
    !options.includePrerelease &&
 | 
			
		||||
    lt.semver.prerelease.length ? lt.semver : false
 | 
			
		||||
  let needDomGTPre = gt &&
 | 
			
		||||
    !options.includePrerelease &&
 | 
			
		||||
    gt.semver.prerelease.length ? gt.semver : false
 | 
			
		||||
  // exception: <1.2.3-0 is the same as <1.2.3
 | 
			
		||||
  if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
 | 
			
		||||
      lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
 | 
			
		||||
    needDomLTPre = false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  for (const c of dom) {
 | 
			
		||||
    hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
 | 
			
		||||
    hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
 | 
			
		||||
    if (gt) {
 | 
			
		||||
      if (needDomGTPre) {
 | 
			
		||||
        if (c.semver.prerelease && c.semver.prerelease.length &&
 | 
			
		||||
            c.semver.major === needDomGTPre.major &&
 | 
			
		||||
            c.semver.minor === needDomGTPre.minor &&
 | 
			
		||||
            c.semver.patch === needDomGTPre.patch) {
 | 
			
		||||
          needDomGTPre = false
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (c.operator === '>' || c.operator === '>=') {
 | 
			
		||||
        higher = higherGT(gt, c, options)
 | 
			
		||||
        if (higher === c && higher !== gt) {
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (lt) {
 | 
			
		||||
      if (needDomLTPre) {
 | 
			
		||||
        if (c.semver.prerelease && c.semver.prerelease.length &&
 | 
			
		||||
            c.semver.major === needDomLTPre.major &&
 | 
			
		||||
            c.semver.minor === needDomLTPre.minor &&
 | 
			
		||||
            c.semver.patch === needDomLTPre.patch) {
 | 
			
		||||
          needDomLTPre = false
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (c.operator === '<' || c.operator === '<=') {
 | 
			
		||||
        lower = lowerLT(lt, c, options)
 | 
			
		||||
        if (lower === c && lower !== lt) {
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (!c.operator && (lt || gt) && gtltComp !== 0) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // if there was a < or >, and nothing in the dom, then must be false
 | 
			
		||||
  // UNLESS it was limited by another range in the other direction.
 | 
			
		||||
  // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
 | 
			
		||||
  if (gt && hasDomLT && !lt && gtltComp !== 0) {
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (lt && hasDomGT && !gt && gtltComp !== 0) {
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // we needed a prerelease range in a specific tuple, but didn't get one
 | 
			
		||||
  // then this isn't a subset.  eg >=1.2.3-pre is not a subset of >=1.0.0,
 | 
			
		||||
  // because it includes prereleases in the 1.2.3 tuple
 | 
			
		||||
  if (needDomGTPre || needDomLTPre) {
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// >=1.2.3 is lower than >1.2.3
 | 
			
		||||
const higherGT = (a, b, options) => {
 | 
			
		||||
  if (!a) {
 | 
			
		||||
    return b
 | 
			
		||||
  }
 | 
			
		||||
  const comp = compare(a.semver, b.semver, options)
 | 
			
		||||
  return comp > 0 ? a
 | 
			
		||||
    : comp < 0 ? b
 | 
			
		||||
    : b.operator === '>' && a.operator === '>=' ? b
 | 
			
		||||
    : a
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// <=1.2.3 is higher than <1.2.3
 | 
			
		||||
const lowerLT = (a, b, options) => {
 | 
			
		||||
  if (!a) {
 | 
			
		||||
    return b
 | 
			
		||||
  }
 | 
			
		||||
  const comp = compare(a.semver, b.semver, options)
 | 
			
		||||
  return comp < 0 ? a
 | 
			
		||||
    : comp > 0 ? b
 | 
			
		||||
    : b.operator === '<' && a.operator === '<=' ? b
 | 
			
		||||
    : a
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = subset
 | 
			
		||||
							
								
								
									
										10
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/to-comparators.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/to-comparators.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
 | 
			
		||||
// Mostly just for testing and legacy API reasons
 | 
			
		||||
const toComparators = (range, options) =>
 | 
			
		||||
  new Range(range, options).set
 | 
			
		||||
    .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
 | 
			
		||||
 | 
			
		||||
module.exports = toComparators
 | 
			
		||||
							
								
								
									
										13
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/valid.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								qwen/nodejs/node_modules/jest-snapshot/node_modules/semver/ranges/valid.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
const Range = require('../classes/range')
 | 
			
		||||
const validRange = (range, options) => {
 | 
			
		||||
  try {
 | 
			
		||||
    // Return '*' instead of '' so that truthiness works.
 | 
			
		||||
    // This will throw if it's invalid anyway
 | 
			
		||||
    return new Range(range, options).range || '*'
 | 
			
		||||
  } catch (er) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
module.exports = validRange
 | 
			
		||||
							
								
								
									
										63
									
								
								qwen/nodejs/node_modules/jest-snapshot/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								qwen/nodejs/node_modules/jest-snapshot/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,63 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "jest-snapshot",
 | 
			
		||||
  "version": "29.7.0",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "https://github.com/jestjs/jest.git",
 | 
			
		||||
    "directory": "packages/jest-snapshot"
 | 
			
		||||
  },
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "main": "./build/index.js",
 | 
			
		||||
  "types": "./build/index.d.ts",
 | 
			
		||||
  "exports": {
 | 
			
		||||
    ".": {
 | 
			
		||||
      "types": "./build/index.d.ts",
 | 
			
		||||
      "default": "./build/index.js"
 | 
			
		||||
    },
 | 
			
		||||
    "./package.json": "./package.json"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@babel/core": "^7.11.6",
 | 
			
		||||
    "@babel/generator": "^7.7.2",
 | 
			
		||||
    "@babel/plugin-syntax-jsx": "^7.7.2",
 | 
			
		||||
    "@babel/plugin-syntax-typescript": "^7.7.2",
 | 
			
		||||
    "@babel/types": "^7.3.3",
 | 
			
		||||
    "@jest/expect-utils": "^29.7.0",
 | 
			
		||||
    "@jest/transform": "^29.7.0",
 | 
			
		||||
    "@jest/types": "^29.6.3",
 | 
			
		||||
    "babel-preset-current-node-syntax": "^1.0.0",
 | 
			
		||||
    "chalk": "^4.0.0",
 | 
			
		||||
    "expect": "^29.7.0",
 | 
			
		||||
    "graceful-fs": "^4.2.9",
 | 
			
		||||
    "jest-diff": "^29.7.0",
 | 
			
		||||
    "jest-get-type": "^29.6.3",
 | 
			
		||||
    "jest-matcher-utils": "^29.7.0",
 | 
			
		||||
    "jest-message-util": "^29.7.0",
 | 
			
		||||
    "jest-util": "^29.7.0",
 | 
			
		||||
    "natural-compare": "^1.4.0",
 | 
			
		||||
    "pretty-format": "^29.7.0",
 | 
			
		||||
    "semver": "^7.5.3"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@babel/preset-flow": "^7.7.2",
 | 
			
		||||
    "@babel/preset-react": "^7.12.1",
 | 
			
		||||
    "@jest/test-utils": "^29.7.0",
 | 
			
		||||
    "@tsd/typescript": "^5.0.4",
 | 
			
		||||
    "@types/babel__core": "^7.1.14",
 | 
			
		||||
    "@types/graceful-fs": "^4.1.3",
 | 
			
		||||
    "@types/natural-compare": "^1.4.0",
 | 
			
		||||
    "@types/prettier": "^2.1.5",
 | 
			
		||||
    "@types/semver": "^7.1.0",
 | 
			
		||||
    "ansi-regex": "^5.0.1",
 | 
			
		||||
    "ansi-styles": "^5.0.0",
 | 
			
		||||
    "prettier": "^2.1.1",
 | 
			
		||||
    "tsd-lite": "^0.7.0"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "publishConfig": {
 | 
			
		||||
    "access": "public"
 | 
			
		||||
  },
 | 
			
		||||
  "gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user