Skip to content

Commit

Permalink
build: update to latest @rollup/plugin-commonjs version
Browse files Browse the repository at this point in the history
Updates the project to the latest version of `@rollup/plugin-commonjs`. For
this, `rollup` also needs to be updated as the peer dependency from the
CommonJS plugin would not match otherwise.

This results in a change in golden files as the rollup output is slightly
different. We update the goldens as part of this commit.

The update to the latest CommonJS rollup plugin version is in preparation
of bundling the runfile helpers into a checked-in file. Since the runfile
helpers use a dynamic import for loading the NodeJS patches script, the
CommonJS rollup plugin needs to respect those. Currently the CommonJS plugin
just invalidates the dynamic require, while the newer version allows us to
preserve the dynamic CommonJS import as is.
  • Loading branch information
devversion authored and alexeagle committed Apr 7, 2021
1 parent 087a1c3 commit 49b5e08
Show file tree
Hide file tree
Showing 16 changed files with 452 additions and 442 deletions.
157 changes: 81 additions & 76 deletions internal/node/node_patches.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
"protobufjs": "6.8.8",
"protractor": "^5.4.2",
"requirejs": "2.3.6",
"rollup": "2.3.4",
"rollup": "2.44.0",
"rollup-plugin-amd": "4.0.0",
"@rollup/plugin-commonjs": "14.0.0",
"@rollup/plugin-commonjs": "18.0.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "8.4.0",
"rxjs": "^6.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/test/integration/golden.amd.js.map.sha256_
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c924104f49b195bc75b35b75e0b2ef151c06d920a7fbef8788dff3af1ee673df
67c2d1c41362085ed0cdf54cf039cbe8f8e70dbbfad49b2e26d5ca33bf6af406
108 changes: 54 additions & 54 deletions packages/rollup/test/integration/golden.amd.js_
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var far_a_b_c = `@far/a/b/c`;

var MILLISECONDS_IN_MINUTE = 60000;
var MILLISECONDS_IN_MINUTE$6 = 60000;

/**
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
Expand All @@ -26,9 +26,9 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
var date = new Date(dirtyDate.getTime());
var baseTimezoneOffset = date.getTimezoneOffset();
date.setSeconds(0, 0);
var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE;
var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE$6;

return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset
return baseTimezoneOffset * MILLISECONDS_IN_MINUTE$6 + millisecondsPartOfTimezoneOffset
};

/**
Expand All @@ -52,8 +52,8 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var is_date = isDate;

var MILLISECONDS_IN_HOUR = 3600000;
var MILLISECONDS_IN_MINUTE$1 = 60000;
var MILLISECONDS_IN_HOUR$2 = 3600000;
var MILLISECONDS_IN_MINUTE$5 = 60000;
var DEFAULT_ADDITIONAL_DIGITS = 2;

var parseTokenDateTimeDelimeter = /[T ]/;
Expand Down Expand Up @@ -159,7 +159,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
}

if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone) * MILLISECONDS_IN_MINUTE$1;
offset = parseTimezone(dateStrings.timezone) * MILLISECONDS_IN_MINUTE$5;
} else {
var fullTime = timestamp + time;
var fullTimeDate = new Date(fullTime);
Expand Down Expand Up @@ -315,16 +315,16 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
token = parseTokenHH.exec(timeString);
if (token) {
hours = parseFloat(token[1].replace(',', '.'));
return (hours % 24) * MILLISECONDS_IN_HOUR
return (hours % 24) * MILLISECONDS_IN_HOUR$2
}

// hh:mm or hhmm
token = parseTokenHHMM.exec(timeString);
if (token) {
hours = parseInt(token[1], 10);
minutes = parseFloat(token[2].replace(',', '.'));
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE$1
return (hours % 24) * MILLISECONDS_IN_HOUR$2 +
minutes * MILLISECONDS_IN_MINUTE$5
}

// hh:mm:ss or hhmmss
Expand All @@ -333,8 +333,8 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
hours = parseInt(token[1], 10);
minutes = parseInt(token[2], 10);
var seconds = parseFloat(token[3].replace(',', '.'));
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE$1 +
return (hours % 24) * MILLISECONDS_IN_HOUR$2 +
minutes * MILLISECONDS_IN_MINUTE$5 +
seconds * 1000
}

Expand Down Expand Up @@ -614,8 +614,8 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var start_of_day = startOfDay;

var MILLISECONDS_IN_MINUTE$2 = 60000;
var MILLISECONDS_IN_DAY = 86400000;
var MILLISECONDS_IN_MINUTE$4 = 60000;
var MILLISECONDS_IN_DAY$1 = 86400000;

/**
* @category Day Helpers
Expand All @@ -642,14 +642,14 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
var startOfDayRight = start_of_day(dirtyDateRight);

var timestampLeft = startOfDayLeft.getTime() -
startOfDayLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$2;
startOfDayLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$4;
var timestampRight = startOfDayRight.getTime() -
startOfDayRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$2;
startOfDayRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$4;

// Round the number of days to the nearest integer
// because the number of milliseconds in a day is not constant
// (e.g. it's different in the day of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY$1)
}

var difference_in_calendar_days = differenceInCalendarDays;
Expand Down Expand Up @@ -1127,8 +1127,8 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var compare_desc = compareDesc;

var MILLISECONDS_IN_MINUTE$4 = 60000;
var MILLISECONDS_IN_WEEK = 604800000;
var MILLISECONDS_IN_MINUTE$2 = 60000;
var MILLISECONDS_IN_WEEK$3 = 604800000;

/**
* @category ISO Week Helpers
Expand Down Expand Up @@ -1156,14 +1156,14 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
var startOfISOWeekRight = start_of_iso_week(dirtyDateRight);

var timestampLeft = startOfISOWeekLeft.getTime() -
startOfISOWeekLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$4;
startOfISOWeekLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$2;
var timestampRight = startOfISOWeekRight.getTime() -
startOfISOWeekRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$4;
startOfISOWeekRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$2;

// Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK$3)
}

var difference_in_calendar_iso_weeks = differenceInCalendarISOWeeks;
Expand Down Expand Up @@ -1280,8 +1280,8 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var difference_in_calendar_quarters = differenceInCalendarQuarters;

var MILLISECONDS_IN_MINUTE$5 = 60000;
var MILLISECONDS_IN_WEEK$1 = 604800000;
var MILLISECONDS_IN_MINUTE$1 = 60000;
var MILLISECONDS_IN_WEEK$2 = 604800000;

/**
* @category Week Helpers
Expand Down Expand Up @@ -1319,14 +1319,14 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
var startOfWeekRight = start_of_week(dirtyDateRight, dirtyOptions);

var timestampLeft = startOfWeekLeft.getTime() -
startOfWeekLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$5;
startOfWeekLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$1;
var timestampRight = startOfWeekRight.getTime() -
startOfWeekRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$5;
startOfWeekRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE$1;

// Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK$1)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK$2)
}

var difference_in_calendar_weeks = differenceInCalendarWeeks;
Expand Down Expand Up @@ -1423,7 +1423,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var difference_in_milliseconds = differenceInMilliseconds;

var MILLISECONDS_IN_HOUR$2 = 3600000;
var MILLISECONDS_IN_HOUR = 3600000;

/**
* @category Hour Helpers
Expand All @@ -1445,7 +1445,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
* //=> 12
*/
function differenceInHours (dirtyDateLeft, dirtyDateRight) {
var diff = difference_in_milliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_HOUR$2;
var diff = difference_in_milliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_HOUR;
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}

Expand Down Expand Up @@ -1514,7 +1514,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var difference_in_iso_years = differenceInISOYears;

var MILLISECONDS_IN_MINUTE$6 = 60000;
var MILLISECONDS_IN_MINUTE = 60000;

/**
* @category Minute Helpers
Expand All @@ -1536,7 +1536,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
* //=> 12
*/
function differenceInMinutes (dirtyDateLeft, dirtyDateRight) {
var diff = difference_in_milliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_MINUTE$6;
var diff = difference_in_milliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_MINUTE;
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}

Expand Down Expand Up @@ -1916,9 +1916,9 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
format: build_format_locale()
};

var MINUTES_IN_DAY = 1440;
var MINUTES_IN_DAY$1 = 1440;
var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
var MINUTES_IN_MONTH = 43200;
var MINUTES_IN_MONTH$1 = 43200;
var MINUTES_IN_TWO_MONTHS = 86400;

/**
Expand Down Expand Up @@ -2066,7 +2066,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
return localize('aboutXHours', 1, localizeOptions)

// 1.5 hrs up to 24 hrs
} else if (minutes < MINUTES_IN_DAY) {
} else if (minutes < MINUTES_IN_DAY$1) {
var hours = Math.round(minutes / 60);
return localize('aboutXHours', hours, localizeOptions)

Expand All @@ -2075,21 +2075,21 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
return localize('xDays', 1, localizeOptions)

// 1.75 days up to 30 days
} else if (minutes < MINUTES_IN_MONTH) {
var days = Math.round(minutes / MINUTES_IN_DAY);
} else if (minutes < MINUTES_IN_MONTH$1) {
var days = Math.round(minutes / MINUTES_IN_DAY$1);
return localize('xDays', days, localizeOptions)

// 1 month up to 2 months
} else if (minutes < MINUTES_IN_TWO_MONTHS) {
months = Math.round(minutes / MINUTES_IN_MONTH);
months = Math.round(minutes / MINUTES_IN_MONTH$1);
return localize('aboutXMonths', months, localizeOptions)
}

months = difference_in_months(dateRight, dateLeft);

// 2 months up to 12 months
if (months < 12) {
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH$1);
return localize('xMonths', nearestMonth, localizeOptions)

// 1 year up to max Date
Expand All @@ -2114,8 +2114,8 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var distance_in_words = distanceInWords;

var MINUTES_IN_DAY$1 = 1440;
var MINUTES_IN_MONTH$1 = 43200;
var MINUTES_IN_DAY = 1440;
var MINUTES_IN_MONTH = 43200;
var MINUTES_IN_YEAR = 525600;

/**
Expand Down Expand Up @@ -2241,9 +2241,9 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
unit = 's';
} else if (minutes < 60) {
unit = 'm';
} else if (minutes < MINUTES_IN_DAY$1) {
} else if (minutes < MINUTES_IN_DAY) {
unit = 'h';
} else if (minutes < MINUTES_IN_MONTH$1) {
} else if (minutes < MINUTES_IN_MONTH) {
unit = 'd';
} else if (minutes < MINUTES_IN_YEAR) {
unit = 'M';
Expand All @@ -2267,12 +2267,12 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

// 1 up to 30 days
} else if (unit === 'd') {
days = mathPartial(minutes / MINUTES_IN_DAY$1);
days = mathPartial(minutes / MINUTES_IN_DAY);
return localize('xDays', days, localizeOptions)

// 1 up to 12 months
} else if (unit === 'M') {
months = mathPartial(minutes / MINUTES_IN_MONTH$1);
months = mathPartial(minutes / MINUTES_IN_MONTH);
return localize('xMonths', months, localizeOptions)

// 1 year up to max Date
Expand Down Expand Up @@ -2816,7 +2816,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var get_day_of_year = getDayOfYear;

var MILLISECONDS_IN_WEEK$2 = 604800000;
var MILLISECONDS_IN_WEEK$1 = 604800000;

/**
* @category ISO Week Helpers
Expand All @@ -2842,7 +2842,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
// Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round(diff / MILLISECONDS_IN_WEEK$2) + 1
return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1
}

var get_iso_week = getISOWeek;
Expand Down Expand Up @@ -3347,7 +3347,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var get_iso_day = getISODay;

var MILLISECONDS_IN_WEEK$3 = 604800000;
var MILLISECONDS_IN_WEEK = 604800000;

/**
* @category ISO Week-Numbering Year Helpers
Expand All @@ -3373,7 +3373,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
// Round the number of weeks to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round(diff / MILLISECONDS_IN_WEEK$3)
return Math.round(diff / MILLISECONDS_IN_WEEK)
}

var get_iso_weeks_in_year = getISOWeeksInYear;
Expand Down Expand Up @@ -3447,7 +3447,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var get_month = getMonth;

var MILLISECONDS_IN_DAY$1 = 24 * 60 * 60 * 1000;
var MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000;

/**
* @category Range Helpers
Expand Down Expand Up @@ -3503,7 +3503,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

var differenceInMs = overlapEndDate - overlapStartDate;

return Math.ceil(differenceInMs / MILLISECONDS_IN_DAY$1)
return Math.ceil(differenceInMs / MILLISECONDS_IN_DAY)
}

var get_overlapping_days_in_ranges = getOverlappingDaysInRanges;
Expand Down Expand Up @@ -5643,14 +5643,14 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us

const user = "user";

const date = dateFns.format(new Date(2019, 4, 7), 'MMMM D, YYYY');
const foo = `Sunnyvale ${user} ${date}`;
const date$2 = dateFns.format(new Date(2019, 4, 7), 'MMMM D, YYYY');
const foo$2 = `Sunnyvale ${user} ${date$2}`;

const date$1 = dateFns.format(new Date(2019, 4, 7), 'MMMM D, YYYY');
const foo$1 = `@foo/lib/a ${date$1}`;

const date$2 = dateFns.format(new Date(2019, 4, 7), 'MMMM D, YYYY');
const foo$2 = `@foo/lib/a/a/a ${date$2}`;
const date = dateFns.format(new Date(2019, 4, 7), 'MMMM D, YYYY');
const foo = `@foo/lib/a/a/a ${date}`;

const fum = 'Wonderland';

Expand All @@ -5661,7 +5661,7 @@ define(['exports', 'some_global_var'], function (exports, some_global_var) { 'us
const json_key = "json_value";

console.log(
`${hello}, ${name} in ${fum} ${foo} ${foo$1} ${foo$2} ${far_a} ${far_a_b_c} ${json_key}`);
`${hello}, ${name} in ${fum} ${foo$2} ${foo$1} ${foo} ${far_a} ${far_a_b_c} ${json_key}`);

// Test for sequences = false
class A {
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/test/integration/golden.cjs.js.map.sha256_
Original file line number Diff line number Diff line change
@@ -1 +1 @@
86daf398a91b909de1ba663bad9aeff0373fa7e859c304308d6e98d341c7bbc1
7968687ed52c81d2622e22e914927b8acacf641b10097bdf7ca2dedbbc361f26
Loading

0 comments on commit 49b5e08

Please sign in to comment.