-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix null check in paraphrase wrappers (#126)
* Fix wrappers null check * Add integration test * Pin version * Add check for prop existence * Add unit test
- Loading branch information
Showing
7 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const paraphrase = require('paraphrase/percent') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('./mangled') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
module.exports = function(t) { | ||
var e = {}; | ||
|
||
function r(n) { | ||
if (e[n]) return e[n].exports; | ||
var o = e[n] = { | ||
i: n, | ||
l: !1, | ||
exports: {} | ||
}; | ||
return t[n].call(o.exports, o, o.exports, r), o.l = !0, o.exports | ||
} | ||
return r.m = t, r.c = e, r.d = function(t, e, n) { | ||
r.o(t, e) || Object.defineProperty(t, e, { | ||
enumerable: !0, | ||
get: n | ||
}) | ||
}, r.r = function(t) { | ||
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { | ||
value: "Module" | ||
}), Object.defineProperty(t, "__esModule", { | ||
value: !0 | ||
}) | ||
}, r.t = function(t, e) { | ||
if (1 & e && (t = r(t)), 8 & e) return t; | ||
if (4 & e && "object" == typeof t && t && t.__esModule) return t; | ||
var n = Object.create(null); | ||
if (r.r(n), Object.defineProperty(n, "default", { | ||
enumerable: !0, | ||
value: t | ||
}), 2 & e && "string" != typeof t) | ||
for (var o in t) r.d(n, o, function(e) { | ||
return t[e] | ||
}.bind(null, o)); | ||
return n | ||
}, r.n = function(t) { | ||
var e = t && t.__esModule ? function() { | ||
return t. | ||
default | ||
} : function() { | ||
return t | ||
}; | ||
return r.d(e, "a", e), e | ||
}, r.o = function(t, e) { | ||
return Object.prototype.hasOwnProperty.call(t, e) | ||
}, r.p = "", r(r.s = 5) | ||
}([ | ||
function(t, e, r) { | ||
function n(t) { | ||
return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { | ||
return typeof t | ||
} : function(t) { | ||
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t | ||
})(t) | ||
} | ||
var o = r(1), | ||
u = Object.seal(["string", "number"]); | ||
t.exports = function() { | ||
for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++) e[r] = arguments[r]; | ||
var i = { | ||
recursive: !0, | ||
resolve: !0, | ||
clean: !1 | ||
}; | ||
|
||
function f() { | ||
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", | ||
r = arguments.length > 1 ? arguments[1] : void 0; | ||
if ("string" != typeof t) throw new TypeError("paraphrase expects first argument to be a string, got a ".concat(n(t), " (").concat(t, ")")); | ||
if (!r) return t; | ||
for (var c = arguments.length, l = new Array(c > 2 ? c - 2 : 0), y = 2; y < c; y++) l[y - 2] = arguments[y]; | ||
|
||
function a(t, e) { | ||
var c = i.resolve ? o(r, e.trim()) : r[e.trim()]; | ||
return u.includes(n(c)) ? c : i.clean ? "" : t | ||
} | ||
u.includes(n(r)) && (r = [r].concat(l)); | ||
var p = e.reduce((function(t, e) { | ||
return t.replace(e, a) | ||
}), t); | ||
return i.recursive && t !== p ? f.apply(void 0, [p, r].concat(l)) : p | ||
} | ||
return e.length && c(e[e.length - 1]) && Object.assign(i, e.pop()), f.patterns = e, f | ||
}; | ||
var c = function(t) { | ||
return "[object Object]" === "".concat(t) | ||
} | ||
}, | ||
function(t, e, r) { | ||
"use strict"; | ||
|
||
function n(t) { | ||
return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { | ||
return typeof t | ||
} : function(t) { | ||
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t | ||
})(t) | ||
} | ||
|
||
function o(t) { | ||
return (o = "function" == typeof Symbol && "symbol" === n(Symbol.iterator) ? function(t) { | ||
return n(t) | ||
} : function(t) { | ||
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : n(t) | ||
})(t) | ||
} | ||
t.exports = function(t) { | ||
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""; | ||
return e.split(".").reduce((function(t, e) { | ||
return "object" === o(t) ? t[e] : t | ||
}), t) | ||
} | ||
}, , , , | ||
function(t, e, r) { | ||
t.exports = r(0)(/%{([^{}]*)}/gm) | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
"test/unit/webpack-wrapper-null/input.js", | ||
"test/unit/webpack-wrapper-null/mangled.js" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9461,6 +9461,11 @@ [email protected]: | |
query-string "^5.0.1" | ||
sort-keys "^2.0.0" | ||
|
||
notate@^1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/notate/-/notate-1.1.2.tgz#29447d80c3789a4c9f196bdc64b4068618dde9f6" | ||
integrity sha512-87c1SbFP7TvHk1gdc1ZRTk+0wr+1VbKC6Nm3cW7xqHjEyU0eY27fOHjJnWmxFkgSkQF/kaLj9PfvtUh13GjHMQ== | ||
|
||
npm-audit-report@^1.3.2: | ||
version "1.3.2" | ||
resolved "https://registry.yarnpkg.com/npm-audit-report/-/npm-audit-report-1.3.2.tgz#303bc78cd9e4c226415076a4f7e528c89fc77018" | ||
|
@@ -10151,6 +10156,13 @@ param-case@^1.1.0: | |
dependencies: | ||
sentence-case "^1.1.2" | ||
|
||
[email protected]: | ||
version "1.8.0" | ||
resolved "https://registry.yarnpkg.com/paraphrase/-/paraphrase-1.8.0.tgz#7ba038d176f4585674162a4bd825932b8b6ac22c" | ||
integrity sha512-447jeY7a82JcPtJht+rEEnlSeKFmaZezMpkeQTtWB88n8PtJew/HIGHhmvjxi2QfSiRECeIJ6XkZ9U8w0neCZg== | ||
dependencies: | ||
notate "^1.1.2" | ||
|
||
parents@^1.0.0, parents@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" | ||
|