Skip to content

Commit b6a9bf0

Browse files
authored
Expand the size analysis cli to support bundle size analysis (#3873)
* add entry point to bundle analysis * define bundle definition format and handle input validation * add mode * save progress * implement rollup analysis * implement local mode * implement webpack npm mode * support webpack local mode * rearrange files * move files to folder * create a single temp project for both rollup and webpack analysis * fix lint errors * update yarn.lock * fix lint errors * fix failing tests * debug bundle * fix bugs * update lock file * address comments
1 parent 0204abf commit b6a9bf0

38 files changed

+931
-68
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"api-report": "lerna run --scope @firebase/*-exp api-report",
5353
"docgen:exp": "ts-node-script scripts/exp/docgen.ts",
5454
"postinstall": "yarn --cwd repo-scripts/changelog-generator build",
55-
"sa": "ts-node-script repo-scripts/size-analysis/analysis.ts"
55+
"sa": "ts-node-script repo-scripts/size-analysis/cli.ts"
5656
},
5757
"repository": {
5858
"type": "git",

packages-exp/auth-exp/src/core/action_code_url.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ function parseDeepLink(url: string): string {
7676
return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;
7777
}
7878

79-
/**
80-
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL}
81-
*
79+
/**
80+
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL}
81+
*
8282
* @public
8383
*/
8484
export class ActionCodeURL implements externs.ActionCodeURL {
@@ -129,9 +129,9 @@ export class ActionCodeURL implements externs.ActionCodeURL {
129129
}
130130
}
131131

132-
/**
133-
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL.parseLink}
134-
*
132+
/**
133+
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL.parseLink}
134+
*
135135
* @public
136136
*/
137137
export function parseActionCodeURL(link: string): externs.ActionCodeURL | null {

packages-exp/auth-exp/src/platform_browser/iframe/gapi.iframes.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
// For some reason, the linter doesn't recognize that these are used elsewhere
19-
// in the SDK
20-
/* eslint-disable @typescript-eslint/no-unused-vars */
18+
// For some reason, the linter doesn't recognize that these are used elsewhere
19+
// in the SDK
20+
/* eslint-disable @typescript-eslint/no-unused-vars */
2121

2222
declare namespace gapi {
2323
type LoadCallback = () => void;

packages/auth/demo/public/sample-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* @license
3-
* Copyright 2017 Google Inc. All Rights Reserved.
3+
* Copyright 2017 Google LLC All Rights Reserved.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
66
* in compliance with the License. You may obtain a copy of the License at

packages/auth/demo/public/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/demo/public/service-worker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/autheventmanager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/authuser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/cordovahandler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/defines.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/exports_auth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/iframeclient/ifchandler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/rpchandler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/src/storageusermanager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/auth_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/autheventmanager_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/authuser_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/cordovahandler_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/iframeclient/ifchandler_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/rpchandler_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/auth/test/storageusermanager_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/util/index.node.ts

+1
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ export * from './src/subscribe';
3636
export * from './src/validation';
3737
export * from './src/utf8';
3838
export * from './src/exponential_backoff';
39+
export * from './src/formatters';

packages/util/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ export * from './src/subscribe';
3131
export * from './src/validation';
3232
export * from './src/utf8';
3333
export * from './src/exponential_backoff';
34+
export * from './src/formatters';

packages/util/src/formatters.ts

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* Provide English ordinal letters after a number
20+
*/
21+
export function ordinal(i: number): string {
22+
if (!Number.isFinite(i)) {
23+
return `${i}`;
24+
}
25+
return i + indicator(i);
26+
}
27+
28+
function indicator(i: number): string {
29+
i = Math.abs(i);
30+
const cent = i % 100;
31+
if (cent >= 10 && cent <= 20) {
32+
return 'th';
33+
}
34+
const dec = i % 10;
35+
if (dec === 1) {
36+
return 'st';
37+
}
38+
if (dec === 2) {
39+
return 'nd';
40+
}
41+
if (dec === 3) {
42+
return 'rd';
43+
}
44+
return 'th';
45+
}

0 commit comments

Comments
 (0)