@arms/rum-bundler-plugin-core
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -685,3 +685,3 @@ (function (global, factory) { | ||
_injectUUIDIntoSourceFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourceFileContent, sourceFilePath, uuid, bundleToolType) { | ||
var newContent, debugIdSnippet, matchResult, len; | ||
var debugIdSnippet, matchResult, newContent, len; | ||
return _regeneratorRuntime().wrap(function _callee3$(_context3) { | ||
@@ -691,12 +691,11 @@ while (1) switch (_context3.prev = _context3.next) { | ||
_context3.prev = 0; | ||
debugIdSnippet = generateDebugIdSnippet(uuid); | ||
matchResult = sourceFileContent.match(/^(?:\s*|\/\*[\s\S]*?\*\/|\/\/[^\n\r]*[\n\r])*(?:"use strict";|'use strict';)?/); | ||
newContent = ''; | ||
debugIdSnippet = generateDebugIdSnippet(uuid); | ||
if (bundleToolType === 'vite') { | ||
matchResult = sourceFileContent.match(/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/); | ||
if (matchResult !== null && matchResult !== void 0 && matchResult[0]) { | ||
len = matchResult[0].length; | ||
newContent = sourceFileContent.slice(0, len) + debugIdSnippet + sourceFileContent.slice(len); | ||
} | ||
if (matchResult !== null && matchResult !== void 0 && matchResult[0]) { | ||
len = matchResult[0].length; | ||
newContent = sourceFileContent.slice(0, len) + debugIdSnippet + sourceFileContent.slice(len); | ||
} else { | ||
newContent = debugIdSnippet + sourceFileContent; | ||
} | ||
newContent = newContent || debugIdSnippet + sourceFileContent; | ||
_context3.next = 7; | ||
@@ -703,0 +702,0 @@ return fs__namespace.writeFile(sourceFilePath, newContent); |
{ | ||
"name": "@arms/rum-bundler-plugin-core", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "rum bundler plugin core", | ||
@@ -5,0 +5,0 @@ "author": "ly403664 <ly403664@alibaba-inc.com>", |
31156
771