Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Unified Diff: third_party/WebKit/Source/devtools/scripts/namespaces.js

Issue 2626143004: DevTools: move from Common module - Geometry and CSSShadowModel (Closed)
Patch Set: minimize test diff Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/scripts/namespaces.js
diff --git a/third_party/WebKit/Source/devtools/scripts/namespaces.js b/third_party/WebKit/Source/devtools/scripts/namespaces.js
index e395f1c67465762bbafb1f76963861c7ada8a795..ded82ef27691238f6362084df8cd365276361578 100644
--- a/third_party/WebKit/Source/devtools/scripts/namespaces.js
+++ b/third_party/WebKit/Source/devtools/scripts/namespaces.js
@@ -1,5 +1,7 @@
const fs = require('fs');
+const TARGET_MODULE = 'UI';
+
function depends(module, from)
{
if (module === from)
@@ -58,7 +60,7 @@ function read(filePath)
var newName;
- newName = moduleName + "." + name;
+ newName = TARGET_MODULE + "." + name;
var existing = map.get(name);
if (existing && existing.weight > weight)
continue;
@@ -75,18 +77,22 @@ function write(filePath)
for (var key of sortedKeys) {
var originalIdentifier = key;
var newIdentifier = map.get(key).name;
- newContent = newContent.split("\n").map(function (line) {
- return processLine(line);
- }).join("\n");
+ newContent = newContent.split("\n").map(line => processLine(line, originalIdentifier, newIdentifier)).join("\n");
}
if (content !== newContent)
fs.writeFileSync(filePath, newContent);
}
-function processLine(line) {
- // Add transformation logic
- return line;
+function processLine(line, originalIdentifier, newIdentifier) {
+ return line.replace(new RegExp(`^var ${originalIdentifier}`, "g"), `${newIdentifier}`)
+ .replace(new RegExp(`^function ${originalIdentifier}`, "g"), `${newIdentifier} = function`)
+ .replace(new RegExp(`^${originalIdentifier}\\.`, "g"), `${newIdentifier}.`)
+ .replace(new RegExp(`([^."'])(\\b${originalIdentifier}\\b)(?!(\.js|[ ]|[']))`, "g"), usageReplacer);
+
+ function usageReplacer(match, p1) {
+ return [p1, newIdentifier].join("");
+ }
}
function walkSync(currentDirPath, process, json) {
@@ -114,7 +120,7 @@ walkSync('front_end', read);
sortedKeys = Array.from(map.keys());
sortedKeys.sort((a, b) => a.localeCompare(b));
-
+sortedKeys = ['Size', 'Insets', 'Constraints'];
for (var key of sortedKeys)
console.log(key + " => " + map.get(key).name);
« no previous file with comments | « third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698