From ab4e8129d5c94ff96e6c85d0d2b66a04a052b4e5 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 09 六月 2022 15:26:15 +0800
Subject: [PATCH] TODO#139888 嚴選配對 - 文案修改

---
 PAMapp/node_modules/ts-jest/dist/transformers/path-mapping.js |   59 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/PAMapp/node_modules/ts-jest/dist/transformers/path-mapping.js b/PAMapp/node_modules/ts-jest/dist/transformers/path-mapping.js
index 8c7b398..f10abd8 100644
--- a/PAMapp/node_modules/ts-jest/dist/transformers/path-mapping.js
+++ b/PAMapp/node_modules/ts-jest/dist/transformers/path-mapping.js
@@ -1,15 +1,4 @@
 "use strict";
-var __assign = (this && this.__assign) || function () {
-    __assign = Object.assign || function(t) {
-        for (var s, i = 1, n = arguments.length; i < n; i++) {
-            s = arguments[i];
-            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
-                t[p] = s[p];
-        }
-        return t;
-    };
-    return __assign.apply(this, arguments);
-};
 var __values = (this && this.__values) || function(o) {
     var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
     if (m) return m.call(o);
@@ -25,14 +14,16 @@
 exports.factory = exports.name = exports.version = void 0;
 var path_1 = require("path");
 var bs_logger_1 = require("bs-logger");
-exports.version = 1;
-exports.name = 'hoist-jest';
-var isBaseDir = function (base, dir) { var _a; return !((_a = path_1.relative(base, dir)) === null || _a === void 0 ? void 0 : _a.startsWith('.')); };
+exports.version = 2;
+exports.name = 'path-mapping';
+var isBaseDir = function (base, dir) { var _a; return !((_a = (0, path_1.relative)(base, dir)) === null || _a === void 0 ? void 0 : _a.startsWith('.')); };
 function factory(_a) {
     var _b;
     var configSet = _a.configSet;
-    var logger = configSet.logger.child({ namespace: 'ts-path-mapping' });
+    var logger = configSet.logger.child({ namespace: exports.name });
+    logger.warn('path-mapping AST transformer is deprecated and will be removed in `ts-jest` v28. Please use an alternative one, like https://github.com/LeDDGroup/typescript-transform-paths instead');
     var ts = configSet.compilerModule;
+    var tsFactory = ts.factory ? ts.factory : ts;
     var compilerOptions = configSet.parsedTsConfig.options;
     var rootDirs = (_b = compilerOptions.rootDirs) === null || _b === void 0 ? void 0 : _b.filter(path_1.isAbsolute);
     var isDynamicImport = function (node) {
@@ -47,7 +38,7 @@
     };
     var createVisitor = function (ctx, sf) {
         var fileName = sf.fileName;
-        var fileDir = path_1.normalize(path_1.dirname(fileName));
+        var fileDir = (0, path_1.normalize)((0, path_1.dirname)(fileName));
         var rewritePath = function (importPath) {
             var e_1, _a;
             var p = importPath;
@@ -55,7 +46,7 @@
             if (resolvedModule) {
                 var resolvedFileName = resolvedModule.resolvedFileName;
                 var filePath = fileDir;
-                var modulePath = path_1.dirname(resolvedFileName);
+                var modulePath = (0, path_1.dirname)(resolvedFileName);
                 if (rootDirs) {
                     var fileRootDir = '';
                     var moduleRootDir = '';
@@ -76,12 +67,12 @@
                         finally { if (e_1) throw e_1.error; }
                     }
                     if (fileRootDir && moduleRootDir) {
-                        filePath = path_1.relative(fileRootDir, filePath);
-                        modulePath = path_1.relative(moduleRootDir, modulePath);
+                        filePath = (0, path_1.relative)(fileRootDir, filePath);
+                        modulePath = (0, path_1.relative)(moduleRootDir, modulePath);
                     }
                 }
-                p = path_1.normalize(path_1.join(path_1.relative(filePath, modulePath), path_1.basename(resolvedFileName)));
-                p = p.startsWith('.') ? p : "./" + p;
+                p = (0, path_1.normalize)((0, path_1.join)((0, path_1.relative)(filePath, modulePath), (0, path_1.basename)(resolvedFileName)));
+                p = p.startsWith('.') ? p : "./".concat(p);
             }
             return p;
         };
@@ -90,25 +81,41 @@
             var newNode = ts.getMutableClone(node);
             if (isDynamicImport(node) || isRequire(node)) {
                 rewrittenPath = rewritePath(node.arguments[0].text);
-                return __assign(__assign({}, newNode), { arguments: ts.createNodeArray([ts.createStringLiteral(rewrittenPath)]) });
+                var argumentArrays = tsFactory.createNodeArray([tsFactory.createStringLiteral(rewrittenPath)]);
+                return ts.factory
+                    ? ts.factory.updateCallExpression(node, node.expression, node.typeArguments, argumentArrays)
+                    : ts.updateCall(node, node.expression, node.typeArguments, argumentArrays);
             }
             if (ts.isExternalModuleReference(node) && ts.isStringLiteral(node.expression)) {
                 rewrittenPath = rewritePath(node.expression.text);
-                return ts.updateExternalModuleReference(newNode, ts.createLiteral(rewrittenPath));
+                return tsFactory.updateExternalModuleReference(newNode, tsFactory.createStringLiteral(rewrittenPath));
             }
             if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {
                 rewrittenPath = rewritePath(node.moduleSpecifier.text);
-                return __assign(__assign({}, newNode), { moduleSpecifier: ts.createLiteral(rewrittenPath) });
+                return +ts.versionMajorMinor >= 4.5
+                    ? tsFactory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, tsFactory.createStringLiteral(rewrittenPath), node.assertClause)
+                    :
+                        tsFactory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, tsFactory.createStringLiteral(rewrittenPath));
             }
             if (ts.isExportDeclaration(node) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) {
                 rewrittenPath = rewritePath(node.moduleSpecifier.text);
-                return __assign(__assign({}, newNode), { moduleSpecifier: ts.createLiteral(rewrittenPath) });
+                var stringLiteralNode = tsFactory.createStringLiteral(rewrittenPath);
+                if (ts.factory) {
+                    return +ts.versionMajorMinor >= 4.5
+                        ? ts.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, stringLiteralNode, node.assertClause)
+                        :
+                            ts.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, stringLiteralNode);
+                }
+                else {
+                    return ts.updateExportDeclaration(node, node.decorators, node.modifiers, node.exportClause, stringLiteralNode, node.isTypeOnly);
+                }
             }
             if (ts.isImportTypeNode(node) &&
                 ts.isLiteralTypeNode(node.argument) &&
                 ts.isStringLiteral(node.argument.literal)) {
                 rewrittenPath = rewritePath(node.argument.literal.text);
-                return __assign(__assign({}, newNode), { argument: ts.createLiteralTypeNode(ts.createStringLiteral(rewrittenPath)) });
+                var importArguments = tsFactory.createLiteralTypeNode(tsFactory.createStringLiteral(rewrittenPath));
+                return tsFactory.updateImportTypeNode(node, importArguments, node.qualifier, node.typeArguments, node.isTypeOf);
             }
             return ts.visitEachChild(node, visitor, ctx);
         };

--
Gitblit v1.8.0