From 26a09f08cf1ed43c640879f23fdad56c5c9282f7 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:02:38 +0800 Subject: [PATCH] TODO#139884 Banner 1 文案調整 --- PAMapp/node_modules/@jest/transform/build/ScriptTransformer.js | 41 ++++++++++++++++++++++++----------------- 1 files changed, 24 insertions(+), 17 deletions(-) diff --git a/PAMapp/node_modules/@jest/transform/build/ScriptTransformer.js b/PAMapp/node_modules/@jest/transform/build/ScriptTransformer.js index 9ec3358..edc7f2c 100644 --- a/PAMapp/node_modules/@jest/transform/build/ScriptTransformer.js +++ b/PAMapp/node_modules/@jest/transform/build/ScriptTransformer.js @@ -3,8 +3,8 @@ Object.defineProperty(exports, '__esModule', { value: true }); -exports.createTranspilingRequire = createTranspilingRequire; exports.createScriptTransformer = createScriptTransformer; +exports.createTranspilingRequire = createTranspilingRequire; function _crypto() { const data = require('crypto'); @@ -130,6 +130,8 @@ require('./enhanceUnexpectedTokenMessage') ); +var _runtimeErrorsAndWarnings = require('./runtimeErrorsAndWarnings'); + var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); function _interopRequireDefault(obj) { @@ -212,15 +214,14 @@ class ScriptTransformer { constructor(_config, _cacheFS) { - this._config = _config; - this._cacheFS = _cacheFS; - _defineProperty(this, '_cache', void 0); _defineProperty(this, '_transformCache', new Map()); _defineProperty(this, '_transformsAreLoaded', false); + this._config = _config; + this._cacheFS = _cacheFS; const configString = (0, _fastJsonStableStringify().default)(this._config); let projectCache = projectCaches.get(configString); @@ -383,7 +384,11 @@ ); if (!transformer) { - throw new TypeError('Jest: a transform must export something.'); + throw new Error( + (0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)( + transformPath + ) + ); } if (typeof transformer.createTransformer === 'function') { @@ -394,8 +399,10 @@ typeof transformer.process !== 'function' && typeof transformer.processAsync !== 'function' ) { - throw new TypeError( - 'Jest: a transform must export a `process` or `processAsync` function.' + throw new Error( + (0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)( + transformPath + ) ); } @@ -499,10 +506,8 @@ } else if (processed != null && typeof processed.code === 'string') { transformed = processed; } else { - throw new TypeError( - "Jest: a transform's `process` function must return a string, " + - 'or an object with `code` key containing this string. ' + - "It's `processAsync` function must return a Promise resolving to it." + throw new Error( + (0, _runtimeErrorsAndWarnings.makeInvalidReturnValueError)() ); } } @@ -521,10 +526,12 @@ } catch { const transformPath = this._getTransformPath(filename); + invariant(transformPath); console.warn( - `jest-transform: The source map produced for the file ${filename} ` + - `by ${transformPath} was invalid. Proceeding without source ` + - 'mapping for that file.' + (0, _runtimeErrorsAndWarnings.makeInvalidSourceMapWarning)( + filename, + transformPath + ) ); } } // That means that the transform has a custom instrumentation @@ -977,10 +984,10 @@ return null; } - const code = content.substr(33); + const code = content.substring(33); const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); - if (checksum === content.substr(0, 32)) { + if (checksum === content.substring(0, 32)) { return code; } @@ -1097,7 +1104,7 @@ invariant(name); invariant( typeof transformer.process === 'function', - `Jest: synchronous transformer ${name} must export a "process" function.` + (0, _runtimeErrorsAndWarnings.makeInvalidSyncTransformerError)(name) ); } -- Gitblit v1.8.0