@bundle-stats/utils 4.1.2-alpha.0 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,16 +37,19 @@ console.log(report.insights.webpack.assetsSizeTotal.data.text);
37
37
 
38
38
  ## Related projects
39
39
 
40
- ### :cyclone: [relative-ci.com](https://relative-ci.com)
40
+ ### :cyclone: [relative-ci.com](https://relative-ci.com?utm_medium=bundle-stats-utils)
41
41
 
42
- Specialized insights for web bundles:
42
+ #### In-depth webpack bundle analysis and monitoring
43
43
 
44
- - Analyze and monitor webpack stats(bundle size, assets, modules, packages)
45
- - GitHub Check, GitHub Pull Request, and Slack integrations
46
- - Support for all major CI services (CircleCI, GitHub Actions, Gitlab CI, Jenkins, Travis CI)
47
- - Free for OpenSource, developers and small teams
44
+ RelativeCI automates webpack bundle analysis, monitoring, and alerting so you can identify and fix bundle regressions before shipping to production:
48
45
 
49
- [Try for free](https://relative-ci.com?utm_source=github&utm_medium=bundle-stats)
46
+ - :crystal_ball: Analyze webpack bundle stats on every build
47
+ - :chart_with_upwards_trend: Monitor webpack bundle stats changes and identify tendencies over extended periods
48
+ - :bell: Get notified via GitHub Checks, GitHub Pull Request comments, and Slack notifications
49
+ - :hammer: Support for all major CI services (CircleCI, GitHub Actions, Gitlab CI, Jenkins, Travis CI)
50
+ - :two_hearts: Always free for Open Source
51
+
52
+ [Try for free](https://relative-ci.com?utm_medium=bundle-stats-utils)
50
53
 
51
54
  ### :first_quarter_moon: [relative-ci/compare](https://compare.relative-ci.com)
52
55
 
@@ -56,4 +59,4 @@ Standalone web application to compare Webpack/Lighthouse/Browsertime stats.
56
59
 
57
60
  ### :zap: [bundle-stats-action](https://github.com/vio/bundle-stats-action)
58
61
 
59
- Github Action that generates [bundle-stats](https://github.com/relative-ci/bundle-stats) reports for webpack.
62
+ Github Action that generates [bundle-stats](https://github.com/relative-ci/bundle-stats) reports.
package/lib/utils/date.js CHANGED
@@ -1,25 +1,59 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatTime = exports.formatDate = void 0;
4
- const navigatorLanguages = (typeof navigator !== 'undefined' && navigator.languages) || 'en';
5
- const formatDate = (value) => {
6
- const date = typeof value === 'string' ? new Date(value) : value;
7
- return new Intl.DateTimeFormat(navigatorLanguages, {
8
- day: '2-digit',
9
- month: '2-digit',
10
- year: 'numeric',
11
- }).format(date);
6
+ exports.formatTime = exports.formatDate = exports.formatDateTime = void 0;
7
+ const isDate_1 = __importDefault(require("lodash/isDate"));
8
+ const getNavigatorLanguages = () => (typeof window !== 'undefined' && typeof window.navigator !== 'undefined' && window.navigator.languages) || 'en';
9
+ const getResultAsString = (value) => {
10
+ if ((0, isDate_1.default)(value)) {
11
+ return value.toString();
12
+ }
13
+ if (typeof value === 'number') {
14
+ return value.toString();
15
+ }
16
+ return value || '';
12
17
  };
13
- exports.formatDate = formatDate;
14
- const formatTime = (value) => {
15
- const date = typeof value === 'string' ? new Date(value) : value;
16
- return new Intl.DateTimeFormat(navigatorLanguages, {
17
- ...(process.env.NODE_ENV !== 'test' && {
18
- hour: '2-digit',
19
- }),
20
- minute: '2-digit',
21
- second: '2-digit',
22
- }).format(date);
18
+ const formatDateTime = (formatterOptions, value) => {
19
+ let date;
20
+ let result = '';
21
+ if (!value) {
22
+ return result;
23
+ }
24
+ if ((0, isDate_1.default)(value)) {
25
+ date = value;
26
+ }
27
+ else {
28
+ try {
29
+ date = new Date(value);
30
+ }
31
+ catch (err) {
32
+ return getResultAsString(value);
33
+ }
34
+ }
35
+ const formatter = new Intl.DateTimeFormat(getNavigatorLanguages(), formatterOptions);
36
+ try {
37
+ result = formatter.format(date);
38
+ }
39
+ catch (err) {
40
+ return getResultAsString(value);
41
+ }
42
+ return result;
23
43
  };
44
+ exports.formatDateTime = formatDateTime;
45
+ const formatDate = (value) => (0, exports.formatDateTime)({
46
+ day: '2-digit',
47
+ month: '2-digit',
48
+ year: 'numeric',
49
+ }, value);
50
+ exports.formatDate = formatDate;
51
+ const formatTime = (value) => (0, exports.formatDateTime)({
52
+ ...(process.env.NODE_ENV !== 'test' && {
53
+ hour: '2-digit',
54
+ }),
55
+ minute: '2-digit',
56
+ second: '2-digit',
57
+ }, value);
24
58
  exports.formatTime = formatTime;
25
59
  //# sourceMappingURL=date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.js"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,CAAC,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;AAEtF,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEjE,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE;QACjD,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClB,CAAC,CAAC;AARW,QAAA,UAAU,cAQrB;AAEK,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEjE,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE;QAEjD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI;YACrC,IAAI,EAAE,SAAS;SAChB,CAAC;QACF,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,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACjC;IAAC,OAAO,GAAG,EAAE;QAEZ,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAhCW,QAAA,cAAc,kBAgCzB;AAEK,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAU,EAAE,CACnE,IAAA,sBAAc,EACZ;IACE,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;CAChB,EACD,KAAK,CACN,CAAC;AARS,QAAA,UAAU,cAQnB;AAEG,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAU,EAAE,CACnE,IAAA,sBAAc,EACZ;IAEE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI;QACrC,IAAI,EAAE,SAAS;KAChB,CAAC;IACF,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;CAClB,EACD,KAAK,CACN,CAAC;AAXS,QAAA,UAAU,cAWnB"}
@@ -1,20 +1,50 @@
1
- const navigatorLanguages = (typeof navigator !== 'undefined' && navigator.languages) || 'en';
2
- export const formatDate = (value) => {
3
- const date = typeof value === 'string' ? new Date(value) : value;
4
- return new Intl.DateTimeFormat(navigatorLanguages, {
5
- day: '2-digit',
6
- month: '2-digit',
7
- year: 'numeric',
8
- }).format(date);
1
+ import isDate from 'lodash/isDate';
2
+ const getNavigatorLanguages = () => (typeof window !== 'undefined' && typeof window.navigator !== 'undefined' && window.navigator.languages) || 'en';
3
+ const getResultAsString = (value) => {
4
+ if (isDate(value)) {
5
+ return value.toString();
6
+ }
7
+ if (typeof value === 'number') {
8
+ return value.toString();
9
+ }
10
+ return value || '';
9
11
  };
10
- export const formatTime = (value) => {
11
- const date = typeof value === 'string' ? new Date(value) : value;
12
- return new Intl.DateTimeFormat(navigatorLanguages, {
13
- ...(process.env.NODE_ENV !== 'test' && {
14
- hour: '2-digit',
15
- }),
16
- minute: '2-digit',
17
- second: '2-digit',
18
- }).format(date);
12
+ export const formatDateTime = (formatterOptions, value) => {
13
+ let date;
14
+ let result = '';
15
+ if (!value) {
16
+ return result;
17
+ }
18
+ if (isDate(value)) {
19
+ date = value;
20
+ }
21
+ else {
22
+ try {
23
+ date = new Date(value);
24
+ }
25
+ catch (err) {
26
+ return getResultAsString(value);
27
+ }
28
+ }
29
+ const formatter = new Intl.DateTimeFormat(getNavigatorLanguages(), formatterOptions);
30
+ try {
31
+ result = formatter.format(date);
32
+ }
33
+ catch (err) {
34
+ return getResultAsString(value);
35
+ }
36
+ return result;
19
37
  };
38
+ export const formatDate = (value) => formatDateTime({
39
+ day: '2-digit',
40
+ month: '2-digit',
41
+ year: 'numeric',
42
+ }, value);
43
+ export const formatTime = (value) => formatDateTime({
44
+ ...(process.env.NODE_ENV !== 'test' && {
45
+ hour: '2-digit',
46
+ }),
47
+ minute: '2-digit',
48
+ second: '2-digit',
49
+ }, value);
20
50
  //# sourceMappingURL=date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.js"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,CAAC,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;AAE7F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEjE,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE;QACjD,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,MAA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MAAM,CAAC,KAAK,CAAC,EAAE;QACjB,IAAI,GAAG,KAAK,CAAC;KACd;SAAM;QACL,IAAI;YACF,IAAI,GAAG,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAC;SAC3C;QAAC,OAAO,GAAG,EAAE;YAEZ,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;SACjC;KACF;IAED,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,qBAAqB,EAAE,EAAE,gBAAgB,CAAC,CAAC;IAErF,IAAI;QACF,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACjC;IAAC,OAAO,GAAG,EAAE;QAEZ,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAU,EAAE,CACnE,cAAc,CACZ;IACE,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;CAChB,EACD,KAAK,CACN,CAAC;AAEJ,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAU,EAAE,CACnE,cAAc,CACZ;IAEE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI;QACrC,IAAI,EAAE,SAAS;KAChB,CAAC;IACF,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;CAClB,EACD,KAAK,CACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundle-stats/utils",
3
- "version": "4.1.2-alpha.0",
3
+ "version": "4.1.3",
4
4
  "description": "BundleStats utils",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -35,27 +35,27 @@
35
35
  },
36
36
  "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/utils#readme",
37
37
  "dependencies": {
38
- "@bundle-stats/plugin-webpack-filter": "^4.1.2-alpha.0",
39
- "@bundle-stats/plugin-webpack-validate": "^4.1.2-alpha.0",
38
+ "@bundle-stats/plugin-webpack-filter": "^4.1.3",
39
+ "@bundle-stats/plugin-webpack-validate": "^4.1.3",
40
40
  "query-string": "^7.1.0",
41
41
  "serialize-query-params": "^2.0.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/jest": "29.1.1",
45
- "@types/lodash": "4.14.186",
46
- "core-js": "3.26.0",
45
+ "@types/lodash": "4.14.189",
46
+ "core-js": "3.26.1",
47
47
  "jest": "27.5.1",
48
- "jest-cli": "28.1.3",
48
+ "jest-cli": "29.3.1",
49
49
  "jest-date-mock": "1.0.8",
50
50
  "lodash": "4.17.21",
51
- "regenerator-runtime": "0.13.10",
51
+ "regenerator-runtime": "0.13.11",
52
52
  "rimraf": "3.0.2",
53
53
  "ts-jest": "29.0.3",
54
- "typescript": "4.8.4"
54
+ "typescript": "4.9.3"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "core-js": "^3.0.0",
58
58
  "lodash": "^4.0.0"
59
59
  },
60
- "gitHead": "7014aa16e749d567f9318b8845824f09786649b1"
60
+ "gitHead": "88f6b66c9af17b8761ec3143bf49e696fdf3949b"
61
61
  }
@@ -0,0 +1,73 @@
1
+ import isDate from 'lodash/isDate';
2
+
3
+ // @ts-ignore
4
+ const getNavigatorLanguages = () => (typeof window !== 'undefined' && typeof window.navigator !== 'undefined' && window.navigator.languages) || 'en';
5
+
6
+ const getResultAsString = (value?: Date | string | number): string => {
7
+ if (isDate(value)) {
8
+ return value.toString();
9
+ }
10
+
11
+ if (typeof value === 'number') {
12
+ return value.toString();
13
+ }
14
+
15
+ return value || '';
16
+ };
17
+
18
+ export const formatDateTime = (
19
+ formatterOptions: Intl.DateTimeFormatOptions,
20
+ value?: Date | string | number,
21
+ ): string => {
22
+ let date;
23
+ let result = '';
24
+
25
+ if (!value) {
26
+ return result;
27
+ }
28
+
29
+ if (isDate(value)) {
30
+ date = value;
31
+ } else {
32
+ try {
33
+ date = new Date(value as string | number);
34
+ } catch (err) {
35
+ // noop
36
+ return getResultAsString(value);
37
+ }
38
+ }
39
+
40
+ const formatter = new Intl.DateTimeFormat(getNavigatorLanguages(), formatterOptions);
41
+
42
+ try {
43
+ result = formatter.format(date);
44
+ } catch (err) {
45
+ // noop
46
+ return getResultAsString(value);
47
+ }
48
+
49
+ return result;
50
+ };
51
+
52
+ export const formatDate = (value?: Date | string | number): string =>
53
+ formatDateTime(
54
+ {
55
+ day: '2-digit',
56
+ month: '2-digit',
57
+ year: 'numeric',
58
+ },
59
+ value,
60
+ );
61
+
62
+ export const formatTime = (value?: Date | string | number): string =>
63
+ formatDateTime(
64
+ {
65
+ // Workaround CI node issue
66
+ ...(process.env.NODE_ENV !== 'test' && {
67
+ hour: '2-digit',
68
+ }),
69
+ minute: '2-digit',
70
+ second: '2-digit',
71
+ },
72
+ value,
73
+ );
@@ -1,4 +1,4 @@
1
1
  import * as types from './types';
2
- declare type RunMetrics = Record<string, types.MetricValue>;
2
+ type RunMetrics = Record<string, types.MetricValue>;
3
3
  export declare const mergeMetricsByKey: (runs: Array<RunMetrics>, rowTransformers?: ((row: types.ReportRow) => types.ReportRow)[] | undefined) => Array<types.ReportRow>;
4
4
  export {};
@@ -1,2 +1,3 @@
1
- export function formatDate(value: any): string;
2
- export function formatTime(value: any): string;
1
+ export declare const formatDateTime: (formatterOptions: Intl.DateTimeFormatOptions, value?: Date | string | number) => string;
2
+ export declare const formatDate: (value?: Date | string | number) => string;
3
+ export declare const formatTime: (value?: Date | string | number) => string;
@@ -10,7 +10,7 @@ export interface Asset extends Metric {
10
10
  isChunk: boolean;
11
11
  chunkId?: string;
12
12
  }
13
- export declare type Assets = Record<string, Asset>;
13
+ export type Assets = Record<string, Asset>;
14
14
  export interface MetricsAssets {
15
15
  metrics: {
16
16
  assets: Assets;
@@ -24,7 +24,7 @@ export interface Module extends Metric {
24
24
  chunkIds: Array<String>;
25
25
  duplicated: boolean;
26
26
  }
27
- export declare type Modules = Record<string, Module>;
27
+ export type Modules = Record<string, Module>;
28
28
  export interface MetricsModules {
29
29
  metrics: {
30
30
  duplicateCode: MetricRun;
@@ -36,7 +36,7 @@ export interface MetricsModules {
36
36
  export interface Package extends Metric {
37
37
  path: string;
38
38
  }
39
- export declare type Packages = Record<string, Package>;
39
+ export type Packages = Record<string, Package>;
40
40
  export interface MetricsPackages {
41
41
  metrics: {
42
42
  packages: Packages;
package/src/utils/date.js DELETED
@@ -1,24 +0,0 @@
1
- const navigatorLanguages = (typeof navigator !== 'undefined' && navigator.languages) || 'en';
2
-
3
- export const formatDate = (value) => {
4
- const date = typeof value === 'string' ? new Date(value) : value;
5
-
6
- return new Intl.DateTimeFormat(navigatorLanguages, {
7
- day: '2-digit',
8
- month: '2-digit',
9
- year: 'numeric',
10
- }).format(date);
11
- };
12
-
13
- export const formatTime = (value) => {
14
- const date = typeof value === 'string' ? new Date(value) : value;
15
-
16
- return new Intl.DateTimeFormat(navigatorLanguages, {
17
- // Workaround CI node issue
18
- ...(process.env.NODE_ENV !== 'test' && {
19
- hour: '2-digit',
20
- }),
21
- minute: '2-digit',
22
- second: '2-digit',
23
- }).format(date);
24
- };