Skip to content

Commit afe6874

Browse files
committed
Strip debug asserts from prod builds
1 parent 58c4e9f commit afe6874

File tree

5 files changed

+40
-8
lines changed

5 files changed

+40
-8
lines changed

packages-exp/app-exp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"bugs": {
5252
"url": "https://github.com/firebase/firebase-js-sdk/issues"
5353
},
54-
"typings": "./dist/app-exp.d.ts",
54+
"typings": "./dist/app-exp-public.d.ts",
5555
"nyc": {
5656
"extension": [
5757
".ts"

packages-exp/auth-exp/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
},
3636
"license": "Apache-2.0",
3737
"devDependencies": {
38+
"@rollup/plugin-strip": "^1.3.2",
3839
"rollup": "1.32.1",
3940
"rollup-plugin-json": "4.0.0",
4041
"rollup-plugin-replace": "2.2.0",

packages-exp/auth-exp/rollup.config.js

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

18+
import strip from '@rollup/plugin-strip';
1819
import typescriptPlugin from 'rollup-plugin-typescript2';
1920
import typescript from 'typescript';
2021
import pkg from './package.json';
@@ -23,10 +24,20 @@ const deps = Object.keys(
2324
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
2425
);
2526

27+
/**
28+
* Common plugins for all builds
29+
*/
30+
const commonPlugins = [
31+
strip({
32+
functions: ['debugAssert.*']
33+
})
34+
]
35+
2636
/**
2737
* ES5 Builds
2838
*/
2939
const es5BuildPlugins = [
40+
...commonPlugins,
3041
typescriptPlugin({
3142
typescript
3243
})
@@ -57,6 +68,7 @@ const es5Builds = [
5768
* ES2017 Builds
5869
*/
5970
const es2017BuildPlugins = [
71+
...commonPlugins,
6072
typescriptPlugin({
6173
typescript,
6274
tsconfigOverride: {

packages-exp/auth-exp/src/core/util/delay.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import { isMobileCordova, isReactNative } from '@firebase/util';
1919
import { isOnline } from './navigator';
20+
import { debugAssert } from './assert';
2021

2122
export const _OFFLINE_DELAY_MS = 5000;
2223

@@ -34,9 +35,7 @@ export class Delay {
3435
private readonly longDelay: number
3536
) {
3637
// Internal error when improperly initialized.
37-
if (shortDelay > longDelay) {
38-
throw new Error('Short delay should be less than long delay!');
39-
}
38+
debugAssert(shortDelay > longDelay, 'Short delay should be less than long delay!');
4039
this.isMobile = isMobileCordova() || isReactNative();
4140
}
4241

yarn.lock

+24-4
Original file line numberDiff line numberDiff line change
@@ -1862,14 +1862,23 @@
18621862
resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
18631863
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=
18641864

1865+
"@rollup/plugin-strip@^1.3.2":
1866+
version "1.3.2"
1867+
resolved "https://registry.npmjs.org/@rollup/plugin-strip/-/plugin-strip-1.3.2.tgz#9f52e99add99b835a4a3c14e02385f3726514923"
1868+
integrity sha512-dByULCvYdklJRJ50XqmA/ntyvVuVnnxOrgZ6cIIMBLLzQrsm9Ui15VD+6I8a11w8Ob9R7ySwYjFck9YCMzseKA==
1869+
dependencies:
1870+
"@rollup/pluginutils" "^3.0.4"
1871+
estree-walker "^1.0.1"
1872+
magic-string "^0.25.5"
1873+
18651874
"@rollup/pluginutils@^3.0.1":
18661875
version "3.0.8"
18671876
resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.8.tgz#4e94d128d94b90699e517ef045422960d18c8fde"
18681877
integrity sha512-rYGeAc4sxcZ+kPG/Tw4/fwJODC3IXHYDH4qusdN/b6aLw5LPUbzpecYbEJh4sVQGPFJxd2dBU4kc1H3oy9/bnw==
18691878
dependencies:
18701879
estree-walker "^1.0.1"
18711880

1872-
"@rollup/pluginutils@^3.0.8":
1881+
"@rollup/pluginutils@^3.0.4", "@rollup/pluginutils@^3.0.8":
18731882
version "3.0.9"
18741883
resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.9.tgz#aa6adca2c45e5a1b950103a999e3cddfe49fd775"
18751884
integrity sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg==
@@ -9813,7 +9822,7 @@ [email protected]:
98139822
dependencies:
98149823
sourcemap-codec "^1.4.4"
98159824

9816-
[email protected], magic-string@^0.25.2:
9825+
[email protected], magic-string@^0.25.2, magic-string@^0.25.5:
98179826
version "0.25.7"
98189827
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
98199828
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
@@ -12590,6 +12599,17 @@ [email protected]:
1259012599
rollup-pluginutils "2.8.1"
1259112600
tslib "1.10.0"
1259212601

12602+
12603+
version "0.26.0"
12604+
resolved "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.26.0.tgz#cee2b44d51d9623686656d76dc30a73c4de91672"
12605+
integrity sha512-lUK7XZVG77tu8dmv1L/0LZFlavED/5Yo6e4iMMl6fdox/yKdj4IFRRPPJEXNdmEaT1nDQQeCi7b5IwKHffMNeg==
12606+
dependencies:
12607+
find-cache-dir "^3.2.0"
12608+
fs-extra "8.1.0"
12609+
resolve "1.15.1"
12610+
rollup-pluginutils "2.8.2"
12611+
tslib "1.10.0"
12612+
1259312613
1259412614
version "0.27.0"
1259512615
resolved "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.27.0.tgz#95ff96f9e07d5000a9d2df4d76b548f9a1f83511"
@@ -12618,7 +12638,7 @@ [email protected]:
1261812638
dependencies:
1261912639
estree-walker "^0.6.1"
1262012640

12621-
rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2:
12641+
rollup-pluginutils@2.8.2, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2:
1262212642
version "2.8.2"
1262312643
resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e"
1262412644
integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==
@@ -15536,4 +15556,4 @@ zip-stream@^2.1.2:
1553615556
dependencies:
1553715557
archiver-utils "^2.1.0"
1553815558
compress-commons "^2.1.1"
15539-
readable-stream "^3.4.0"
15559+
readable-stream "^3.4.0"

0 commit comments

Comments
 (0)