Sha256: 928d368eb1f64443950b7a4496322649903940f5fb1203ef2f894a5a776fc19d

Contents?: true

Size: 1.17 KB

Versions: 164

Compression:

Stored size: 1.17 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = deprecationWarning;
const warnings = new Set();
function deprecationWarning(oldName, newName, prefix = "") {
  if (warnings.has(oldName)) return;
  warnings.add(oldName);
  const {
    internal,
    trace
  } = captureShortStackTrace(1, 2);
  if (internal) {
    return;
  }
  console.warn(`${prefix}\`${oldName}\` has been deprecated, please migrate to \`${newName}\`\n${trace}`);
}
function captureShortStackTrace(skip, length) {
  const {
    stackTraceLimit,
    prepareStackTrace
  } = Error;
  let stackTrace;
  Error.stackTraceLimit = 1 + skip + length;
  Error.prepareStackTrace = function (err, stack) {
    stackTrace = stack;
  };
  new Error().stack;
  Error.stackTraceLimit = stackTraceLimit;
  Error.prepareStackTrace = prepareStackTrace;
  if (!stackTrace) return {
    internal: false,
    trace: ""
  };
  const shortStackTrace = stackTrace.slice(1 + skip, 1 + skip + length);
  return {
    internal: /[\\/]@babel[\\/]/.test(shortStackTrace[1].getFileName()),
    trace: shortStackTrace.map(frame => `    at ${frame}`).join("\n")
  };
}

//# sourceMappingURL=deprecationWarning.js.map

Version data entries

164 entries across 16 versions & 3 rubygems

Version Path
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-react-jsx/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.49 node_modules/@babel/preset-modules/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.49 node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.49 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/helper-annotate-as-pure/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/preset-modules/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-react-jsx/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-systemjs/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-computed-properties/node_modules/@babel/template/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-classes/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-async-generator-functions/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/node_modules/@babel/traverse/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/helpers/node_modules/@babel/types/lib/utils/deprecationWarning.js
immosquare-cleaner-0.1.48 node_modules/@babel/helper-wrap-function/node_modules/@babel/types/lib/utils/deprecationWarning.js