From 94fc67a905c1253cbebc86ba355d84fa81ef4a5d Mon Sep 17 00:00:00 2001 From: zhangtao25 Date: Fri, 20 Dec 2024 13:52:16 +0800 Subject: [PATCH] feat: update --- plugins/babel-plugin-canyon/package.json | 2 +- plugins/babel-plugin-canyon/src/template.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/babel-plugin-canyon/package.json b/plugins/babel-plugin-canyon/package.json index a9368f0f..0853598b 100644 --- a/plugins/babel-plugin-canyon/package.json +++ b/plugins/babel-plugin-canyon/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-canyon", - "version": "2.0.0-beta.20", + "version": "2.0.0-beta.21", "description": "", "scripts": { "release": "babel src --extensions \".ts\" --out-dir lib", diff --git a/plugins/babel-plugin-canyon/src/template.ts b/plugins/babel-plugin-canyon/src/template.ts index 60f4b93f..ad805173 100644 --- a/plugins/babel-plugin-canyon/src/template.ts +++ b/plugins/babel-plugin-canyon/src/template.ts @@ -1,3 +1,3 @@ export default { -"templates/write-canyon-to-local-template.js": "(function () {\n var globalObj = undefined;\n try {\n globalObj = new Function('return this')();\n } catch (e) {\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof global !== \"undefined\") {\n globalObj = global;\n } else {\n // do nothing\n }\n }\n if (globalObj){\n\n // ***start***\n\n if (globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal) {\n } else {\n globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal = true\n if (globalObj.document && globalObj.document.addEventListener) {\n if (globalObj.writeCanyonToLocal) {\n globalObj.manualWriteCanyonToLocal = function () {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__\n }))\n }\n }\n globalObj.document.addEventListener('visibilitychange', function () {\n if (globalObj.document.visibilityState === 'hidden') {\n if (globalObj.writeCanyonToLocal) {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__\n }))\n } else {\n console.log('writeCanyonToLocal is not defined')\n }\n }\n });\n }\n }\n\n // **end***\n }\n})()\n" +"templates/write-canyon-to-local-template.js": "(function () {\n var globalObj = undefined;\n try {\n globalObj = new Function('return this')();\n } catch (e) {\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof global !== \"undefined\") {\n globalObj = global;\n } else {\n // do nothing\n }\n }\n if (globalObj){\n\n // ***start***\n\n if (globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal) {\n } else {\n globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal = true\n if (globalObj.document && globalObj.document.addEventListener) {\n if (globalObj.writeCanyonToLocal) {\n globalObj.manualWriteCanyonToLocal = function () {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__ || (Object.keys(globalObj.__coverage__).length>0?Object.values(globalObj.__coverage__)[0]:undefined)\n }))\n }\n }\n globalObj.document.addEventListener('visibilitychange', function () {\n if (globalObj.document.visibilityState === 'hidden') {\n if (globalObj.writeCanyonToLocal) {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__ || (Object.keys(globalObj.__coverage__).length>0?Object.values(globalObj.__coverage__)[0]:undefined)\n }))\n } else {\n console.log('writeCanyonToLocal is not defined')\n }\n }\n });\n }\n }\n\n // **end***\n }\n})()\n" }