Skip to content

Commit 7cf2bbf

Browse files
committed
Repackage action following eslint-plugin-import bump
GitHub downloads each action run in a workflow during runtime and executes it as a complete package of code before you can use workflow commands like run to interact with the runner machine. This means that we must provide all JavaScript package dependencies as part of the distributed action in order for it to be usable in workflows. A naive approach to doing this is checking in the `node_modules` folder. However, this approach results in a huge amount of frequently changing external content being included in the repository, much of which is not even part of the executed program. A far better approach is to use the excellent ncc tool to compile the program, including all the relevant code from the dependencies, into a single file. We use a "continuous packaging" approach, where the packaged action code that is generated via ncc is always kept in sync with the development source code and dependencies. This allows a beta version of the action to be easily used in workflows by beta testers or those who need changes not in the release simply by using the name of the branch as the action ref (e.g., `uses: arduino/arduino-lint-action@main` will cause the version of the action from the tip of the `main` branch to be used by the workflow run). The update of the package dependency results in a change to the packaged code, so the packaging is here updated accordingly.
1 parent 5ae0092 commit 7cf2bbf

File tree

1 file changed

+44
-12
lines changed

1 file changed

+44
-12
lines changed

dist/index.js

+44-12
Original file line numberDiff line numberDiff line change
@@ -6512,43 +6512,75 @@ if ($defineProperty) {
65126512
/* eslint no-invalid-this: 1 */
65136513

65146514
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
6515-
var slice = Array.prototype.slice;
65166515
var toStr = Object.prototype.toString;
6516+
var max = Math.max;
65176517
var funcType = '[object Function]';
65186518

6519+
var concatty = function concatty(a, b) {
6520+
var arr = [];
6521+
6522+
for (var i = 0; i < a.length; i += 1) {
6523+
arr[i] = a[i];
6524+
}
6525+
for (var j = 0; j < b.length; j += 1) {
6526+
arr[j + a.length] = b[j];
6527+
}
6528+
6529+
return arr;
6530+
};
6531+
6532+
var slicy = function slicy(arrLike, offset) {
6533+
var arr = [];
6534+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
6535+
arr[j] = arrLike[i];
6536+
}
6537+
return arr;
6538+
};
6539+
6540+
var joiny = function (arr, joiner) {
6541+
var str = '';
6542+
for (var i = 0; i < arr.length; i += 1) {
6543+
str += arr[i];
6544+
if (i + 1 < arr.length) {
6545+
str += joiner;
6546+
}
6547+
}
6548+
return str;
6549+
};
6550+
65196551
module.exports = function bind(that) {
65206552
var target = this;
6521-
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
6553+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
65226554
throw new TypeError(ERROR_MESSAGE + target);
65236555
}
6524-
var args = slice.call(arguments, 1);
6556+
var args = slicy(arguments, 1);
65256557

65266558
var bound;
65276559
var binder = function () {
65286560
if (this instanceof bound) {
65296561
var result = target.apply(
65306562
this,
6531-
args.concat(slice.call(arguments))
6563+
concatty(args, arguments)
65326564
);
65336565
if (Object(result) === result) {
65346566
return result;
65356567
}
65366568
return this;
6537-
} else {
6538-
return target.apply(
6539-
that,
6540-
args.concat(slice.call(arguments))
6541-
);
65426569
}
6570+
return target.apply(
6571+
that,
6572+
concatty(args, arguments)
6573+
);
6574+
65436575
};
65446576

6545-
var boundLength = Math.max(0, target.length - args.length);
6577+
var boundLength = max(0, target.length - args.length);
65466578
var boundArgs = [];
65476579
for (var i = 0; i < boundLength; i++) {
6548-
boundArgs.push('$' + i);
6580+
boundArgs[i] = '$' + i;
65496581
}
65506582

6551-
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
6583+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
65526584

65536585
if (target.prototype) {
65546586
var Empty = function Empty() {};

0 commit comments

Comments
 (0)