Skip to content

Commit d153a71

Browse files
authored
fix: Patch tslib_1__default regression and add additional test (#1896)
1 parent bd2486f commit d153a71

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/browser/test/manual/npm-build.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ function runTests() {
4444
};
4545

4646
const myLibrary = fs.readFileSync(bundlePath, { encoding: 'utf-8' });
47+
48+
if (myLibrary.indexOf('tslib_1__default') !== -1) {
49+
console.log('"tslib_1__default" reappeared...');
50+
process.exit(1);
51+
}
52+
4753
const scriptEl = window.document.createElement('script');
4854
scriptEl.textContent = myLibrary;
4955
window.document.body.appendChild(scriptEl);

packages/utils/src/memo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class Memo {
2626
this.inner.add(obj);
2727
return false;
2828
} else {
29-
for (const value of this.inner) {
29+
for (let i = 0; i < this.inner.length; i++) {
30+
const value = this.inner[i];
3031
if (value === obj) {
3132
return true;
3233
}

packages/utils/src/object.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function normalizeValue(value: any, key?: any): any {
327327
*/
328328
export function decycle(obj: any, memo: Memo = new Memo()): any {
329329
// tslint:disable-next-line:no-unsafe-any
330-
const copy = isArray(obj) ? [...obj] : isPlainObject(obj) ? { ...obj } : obj;
330+
const copy = isArray(obj) ? obj.slice() : isPlainObject(obj) ? assign({}, obj) : obj;
331331

332332
if (!isPrimitive(obj)) {
333333
if (memo.memoize(obj)) {

0 commit comments

Comments
 (0)