initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 deletions

20
node_modules/grim/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2014 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
node_modules/grim/README.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
# Grim [![Build Status](https://travis-ci.org/atom/grim.svg)](https://travis-ci.org/atom/grim)
Log deprecate calls
## Installing
```sh
npm install grim
```
## Usage
```javascript
Grim = require('grim')
function someOldMethod() {
Grim.deprecate("Use theNewMethod instead.")
}
```
To view all calls to deprecated methods use `Grim.logDeprecations()` or get direct access to the deprecated calls by using `Grim.getDeprecations()`

149
node_modules/grim/lib/deprecation.js generated vendored Normal file
View File

@@ -0,0 +1,149 @@
(function() {
var Deprecation, SourceMapCache;
SourceMapCache = {};
module.exports = Deprecation = (function() {
Deprecation.getFunctionNameFromCallsite = function(callsite) {};
Deprecation.deserialize = function(_arg) {
var deprecation, fileName, lineNumber, message, stack, stacks, _i, _len;
message = _arg.message, fileName = _arg.fileName, lineNumber = _arg.lineNumber, stacks = _arg.stacks;
deprecation = new Deprecation(message, fileName, lineNumber);
for (_i = 0, _len = stacks.length; _i < _len; _i++) {
stack = stacks[_i];
deprecation.addStack(stack, stack.metadata);
}
return deprecation;
};
function Deprecation(message, fileName, lineNumber) {
this.message = message;
this.fileName = fileName;
this.lineNumber = lineNumber;
this.callCount = 0;
this.stackCount = 0;
this.stacks = {};
this.stackCallCounts = {};
}
Deprecation.prototype.getFunctionNameFromCallsite = function(callsite) {
var _ref, _ref1, _ref2;
if (callsite.functionName != null) {
return callsite.functionName;
}
if (callsite.isToplevel()) {
return (_ref = callsite.getFunctionName()) != null ? _ref : '<unknown>';
} else {
if (callsite.isConstructor()) {
return "new " + (callsite.getFunctionName());
} else if (callsite.getMethodName() && !callsite.getFunctionName()) {
return callsite.getMethodName();
} else {
return "" + (callsite.getTypeName()) + "." + ((_ref1 = (_ref2 = callsite.getMethodName()) != null ? _ref2 : callsite.getFunctionName()) != null ? _ref1 : '<anonymous>');
}
}
};
Deprecation.prototype.getLocationFromCallsite = function(callsite) {
var column, fileName, line;
if (callsite.location != null) {
return callsite.location;
}
if (callsite.isNative()) {
return "native";
} else if (callsite.isEval()) {
return "eval at " + (this.getLocationFromCallsite(callsite.getEvalOrigin()));
} else {
fileName = callsite.getFileName();
line = callsite.getLineNumber();
column = callsite.getColumnNumber();
return "" + fileName + ":" + line + ":" + column;
}
};
Deprecation.prototype.getFileNameFromCallSite = function(callsite) {
var _ref;
return (_ref = callsite.fileName) != null ? _ref : callsite.getFileName();
};
Deprecation.prototype.getOriginName = function() {
return this.originName;
};
Deprecation.prototype.getMessage = function() {
return this.message;
};
Deprecation.prototype.getStacks = function() {
var location, parsedStack, parsedStacks, stack, _ref;
parsedStacks = [];
_ref = this.stacks;
for (location in _ref) {
stack = _ref[location];
parsedStack = this.parseStack(stack);
parsedStack.callCount = this.stackCallCounts[location];
parsedStack.metadata = stack.metadata;
parsedStacks.push(parsedStack);
}
return parsedStacks;
};
Deprecation.prototype.getStackCount = function() {
return this.stackCount;
};
Deprecation.prototype.getCallCount = function() {
return this.callCount;
};
Deprecation.prototype.addStack = function(stack, metadata) {
var callerLocation, _base, _base1;
if (this.originName == null) {
this.originName = this.getFunctionNameFromCallsite(stack[0]);
}
if (this.fileName == null) {
this.fileName = this.getFileNameFromCallSite(stack[0]);
}
if (this.lineNumber == null) {
this.lineNumber = typeof (_base = stack[0]).getLineNumber === "function" ? _base.getLineNumber() : void 0;
}
this.callCount++;
stack.metadata = metadata;
callerLocation = this.getLocationFromCallsite(stack[1]);
if (this.stacks[callerLocation] == null) {
this.stacks[callerLocation] = stack;
this.stackCount++;
}
if ((_base1 = this.stackCallCounts)[callerLocation] == null) {
_base1[callerLocation] = 0;
}
return this.stackCallCounts[callerLocation]++;
};
Deprecation.prototype.parseStack = function(stack) {
return stack.map((function(_this) {
return function(callsite) {
return {
functionName: _this.getFunctionNameFromCallsite(callsite),
location: _this.getLocationFromCallsite(callsite),
fileName: _this.getFileNameFromCallSite(callsite)
};
};
})(this));
};
Deprecation.prototype.serialize = function() {
return {
message: this.getMessage(),
lineNumber: this.lineNumber,
fileName: this.fileName,
stacks: this.getStacks()
};
};
return Deprecation;
})();
}).call(this);

112
node_modules/grim/lib/grim.js generated vendored Normal file
View File

@@ -0,0 +1,112 @@
(function() {
var Deprecation, Emitter, getRawStack, grim;
Emitter = require('emissary').Emitter;
Deprecation = require('./deprecation');
if (global.__grim__ == null) {
grim = global.__grim__ = {
deprecations: {},
includeDeprecatedAPIs: true,
getDeprecations: function() {
var deprecation, deprecations, deprecationsByLineNumber, deprecationsByPackage, fileName, lineNumber, packageName, _ref;
deprecations = [];
_ref = grim.deprecations;
for (fileName in _ref) {
deprecationsByLineNumber = _ref[fileName];
for (lineNumber in deprecationsByLineNumber) {
deprecationsByPackage = deprecationsByLineNumber[lineNumber];
for (packageName in deprecationsByPackage) {
deprecation = deprecationsByPackage[packageName];
deprecations.push(deprecation);
}
}
}
return deprecations;
},
getDeprecationsLength: function() {
return this.getDeprecations().length;
},
clearDeprecations: function() {
grim.deprecations = {};
},
logDeprecations: function() {
var deprecation, deprecations, _i, _len;
deprecations = this.getDeprecations();
deprecations.sort(function(a, b) {
return b.getCallCount() - a.getCallCount();
});
console.warn("\nCalls to deprecated functions\n-----------------------------");
for (_i = 0, _len = deprecations.length; _i < _len; _i++) {
deprecation = deprecations[_i];
console.warn("(" + (deprecation.getCallCount()) + ") " + (deprecation.getOriginName()) + " : " + (deprecation.getMessage()), deprecation);
}
},
deprecate: function(message, metadata) {
var deprecation, deprecationSite, error, fileName, lineNumber, originalStackTraceLimit, packageName, stack, _base, _base1, _base2, _ref, _ref1;
originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 7;
error = new Error;
Error.captureStackTrace(error);
Error.stackTraceLimit = originalStackTraceLimit;
stack = (_ref = typeof error.getRawStack === "function" ? error.getRawStack() : void 0) != null ? _ref : getRawStack(error);
stack = stack.slice(1);
deprecationSite = stack[0];
fileName = deprecationSite.getFileName();
lineNumber = deprecationSite.getLineNumber();
packageName = (_ref1 = metadata != null ? metadata.packageName : void 0) != null ? _ref1 : "";
if ((_base = grim.deprecations)[fileName] == null) {
_base[fileName] = {};
}
if ((_base1 = grim.deprecations[fileName])[lineNumber] == null) {
_base1[lineNumber] = {};
}
if ((_base2 = grim.deprecations[fileName][lineNumber])[packageName] == null) {
_base2[packageName] = new Deprecation(message);
}
deprecation = grim.deprecations[fileName][lineNumber][packageName];
deprecation.addStack(stack, metadata);
grim.emit("updated", deprecation);
},
addSerializedDeprecation: function(serializedDeprecation) {
var deprecation, fileName, lineNumber, message, packageName, stack, stacks, _base, _base1, _base2, _i, _len, _ref, _ref1, _ref2;
deprecation = Deprecation.deserialize(serializedDeprecation);
message = deprecation.getMessage();
fileName = deprecation.fileName, lineNumber = deprecation.lineNumber;
stacks = deprecation.getStacks();
packageName = (_ref = (_ref1 = stacks[0]) != null ? (_ref2 = _ref1.metadata) != null ? _ref2.packageName : void 0 : void 0) != null ? _ref : "";
if ((_base = grim.deprecations)[fileName] == null) {
_base[fileName] = {};
}
if ((_base1 = grim.deprecations[fileName])[lineNumber] == null) {
_base1[lineNumber] = {};
}
if ((_base2 = grim.deprecations[fileName][lineNumber])[packageName] == null) {
_base2[packageName] = new Deprecation(message, fileName, lineNumber);
}
deprecation = grim.deprecations[fileName][lineNumber][packageName];
for (_i = 0, _len = stacks.length; _i < _len; _i++) {
stack = stacks[_i];
deprecation.addStack(stack, stack.metadata);
}
grim.emit("updated", deprecation);
}
};
Emitter.extend(grim);
}
getRawStack = function(error) {
var originalPrepareStackTrace, result;
originalPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = function(error, stack) {
return stack;
};
result = error.stack;
Error.prepareStackTrace = originalPrepareStackTrace;
return result;
};
module.exports = global.__grim__;
}).call(this);

38
node_modules/grim/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "grim",
"version": "1.5.0",
"description": "Log usage of deprecated methods",
"main": "./lib/grim",
"scripts": {
"prepublish": "grunt clean lint coffee",
"test": "grunt test"
},
"repository": {
"type": "git",
"url": "https://github.com/atom/grim.git"
},
"bugs": {
"url": "https://github.com/atom/grim/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/atom/grim/raw/master/LICENSE.md"
}
],
"dependencies": {
"emissary": "^1.2.0"
},
"devDependencies": {
"coffee-script": "^1.7.0",
"jasmine-focused": "^1.0.4",
"grunt-contrib-coffee": "^0.9.0",
"grunt-cli": "^0.1.8",
"grunt": "^0.4.1",
"grunt-shell": "^0.2.2",
"grunt-coffeelint": "^0.0.6",
"rimraf": "^2.2.2",
"coffee-cache": "^0.2.0",
"temp": "^0.6.0"
}
}