Skip to content

Commit

Permalink
Expand the size analysis cli to support bundle size analysis (#3873)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Feiyang1 authored Oct 19, 2020
1 parent 0204abf commit b6a9bf0
Show file tree
Hide file tree
Showing 38 changed files with 931 additions and 68 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"api-report": "lerna run --scope @firebase/*-exp api-report",
"docgen:exp": "ts-node-script scripts/exp/docgen.ts",
"postinstall": "yarn --cwd repo-scripts/changelog-generator build",
"sa": "ts-node-script repo-scripts/size-analysis/analysis.ts"
"sa": "ts-node-script repo-scripts/size-analysis/cli.ts"
},
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions packages-exp/auth-exp/src/core/action_code_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ function parseDeepLink(url: string): string {
return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;
}

/**
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL}
*
/**
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL}
*
* @public
*/
export class ActionCodeURL implements externs.ActionCodeURL {
Expand Down Expand Up @@ -129,9 +129,9 @@ export class ActionCodeURL implements externs.ActionCodeURL {
}
}

/**
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL.parseLink}
*
/**
* {@inheritDoc @firebase/auth-types-exp#ActionCodeURL.parseLink}
*
* @public
*/
export function parseActionCodeURL(link: string): externs.ActionCodeURL | null {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

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

declare namespace gapi {
type LoadCallback = () => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/demo/public/sample-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @license
* Copyright 2017 Google Inc. All Rights Reserved.
* Copyright 2017 Google LLC All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/demo/public/script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/demo/public/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/autheventmanager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/authuser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/cordovahandler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/defines.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/exports_auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/iframeclient/ifchandler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/rpchandler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/storageusermanager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/auth_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/autheventmanager_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/authuser_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/cordovahandler_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/iframeclient/ifchandler_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/rpchandler_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/storageusermanager_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions packages/util/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ export * from './src/subscribe';
export * from './src/validation';
export * from './src/utf8';
export * from './src/exponential_backoff';
export * from './src/formatters';
1 change: 1 addition & 0 deletions packages/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ export * from './src/subscribe';
export * from './src/validation';
export * from './src/utf8';
export * from './src/exponential_backoff';
export * from './src/formatters';
45 changes: 45 additions & 0 deletions packages/util/src/formatters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Provide English ordinal letters after a number
*/
export function ordinal(i: number): string {
if (!Number.isFinite(i)) {
return `${i}`;
}
return i + indicator(i);
}

function indicator(i: number): string {
i = Math.abs(i);
const cent = i % 100;
if (cent >= 10 && cent <= 20) {
return 'th';
}
const dec = i % 10;
if (dec === 1) {
return 'st';
}
if (dec === 2) {
return 'nd';
}
if (dec === 3) {
return 'rd';
}
return 'th';
}
Loading

0 comments on commit b6a9bf0

Please sign in to comment.