-
Notifications
You must be signed in to change notification settings - Fork 940
Add minified ("mangled") Firestore build #2495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
090eb7f
Add minified Firestore build
schmidt-sebastian db5d72d
Enable --downlevelIteration
schmidt-sebastian 5e32d50
Ignore dependency warning
schmidt-sebastian 19bba3b
Add .cache to gitignore
schmidt-sebastian 7e7a174
Add .cache to gitignore
schmidt-sebastian 26dd851
Merge branch 'mrschmidt/sdkminifier' of github.com:firebase/firebase-…
schmidt-sebastian 84bd404
Fix
schmidt-sebastian 528c0ea
Merge branch 'master' into mrschmidt/sdkminifier
schmidt-sebastian 47059de
Merge branch 'master' into mrschmidt/sdkminifier
schmidt-sebastian e7556c7
Fix Yarn
schmidt-sebastian 5828543
Use terser 5.1.3
schmidt-sebastian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
node_modules | ||
dist | ||
.awcache | ||
.cache | ||
/config/project.json | ||
scripts/docgen/html | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
import '../../firestore/dist/index.esm.min'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"externs" : [ | ||
"node_modules/typescript/lib/lib.es5.d.ts", | ||
"node_modules/typescript/lib/lib.dom.d.ts", | ||
"node_modules/typescript/lib/lib.es2015.promise.d.ts", | ||
"node_modules/typescript/lib/lib.es2015.symbol.d.ts", | ||
"node_modules/typescript/lib/lib.es2015.iterable.d.ts", | ||
"node_modules/typescript/lib/lib.es2015.collection.d.ts", | ||
"node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts", | ||
"node_modules/typescript/lib/lib.es2015.core.d.ts", | ||
"node_modules/typescript/lib/lib.es2017.object.d.ts", | ||
"packages/app-types/index.d.ts", | ||
"packages/app-types/private.d.ts", | ||
"packages/auth-interop-types/index.d.ts", | ||
"packages/firestore-types/index.d.ts", | ||
"packages/firebase/index.d.ts", | ||
"packages/component/dist/src/component.d.ts", | ||
"packages/component/dist/src/provider.d.ts", | ||
"packages/component/dist/src/component_container.d.ts", | ||
"packages/logger/dist/src/logger.d.ts", | ||
"packages/webchannel-wrapper/src/index.d.ts", | ||
"packages/util/dist/src/environment.d.ts", | ||
"packages/firestore/src/protos/firestore_proto_api.d.ts", | ||
"packages/firestore/dist/lib/src/local/indexeddb_schema.d.ts", | ||
"packages/firestore/dist/lib/src/local/shared_client_state_schema.d.ts" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"description": "", | ||
"author": "Firebase <[email protected]> (https://firebase.google.com/)", | ||
"scripts": { | ||
"prebuild": "tsc -d --downlevelIteration --declarationDir dist/lib --emitDeclarationOnly && tsc -m es2015 --moduleResolution node scripts/*.ts ", | ||
"build": "rollup -c", | ||
"build:console": "node tools/console.build.js", | ||
"dev": "rollup -c -w", | ||
|
@@ -24,8 +25,11 @@ | |
}, | ||
"main": "dist/index.node.cjs.js", | ||
"browser": "dist/index.cjs.js", | ||
"browserMinified": "dist/index.cjs.min.js", | ||
"module": "dist/index.esm.js", | ||
"moduleMinified": "dist/index.esm.min.js", | ||
"esm2017": "dist/index.esm2017.js", | ||
"esm2017Minified": "dist/index.esm2017.min.js", | ||
"license": "Apache-2.0", | ||
"files": [ | ||
"dist" | ||
|
@@ -48,8 +52,10 @@ | |
"protobufjs": "6.8.8", | ||
"rollup": "1.28.0", | ||
"rollup-plugin-copy-assets": "1.1.0", | ||
"rollup-plugin-json": "4.0.0", | ||
"rollup-plugin-node-resolve": "5.2.0", | ||
"rollup-plugin-replace": "2.2.0", | ||
"rollup-plugin-terser": "5.1.3", | ||
"rollup-plugin-typescript2": "0.25.3", | ||
"typescript": "3.7.3" | ||
}, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import * as ts from 'typescript'; | ||
import * as fs from 'fs'; | ||
|
||
function extractIdentifiersFromNodeAndChildren( | ||
node: ts.Node, | ||
symbols: Set<string> | ||
): void { | ||
if (ts.isIdentifier(node)) { | ||
symbols.add(node.escapedText.toString()); | ||
} | ||
|
||
ts.forEachChild(node, (childNode: ts.Node) => | ||
extractIdentifiersFromNodeAndChildren(childNode, symbols) | ||
); | ||
} | ||
|
||
/** | ||
* Traverses TypeScript type definition files and returns the list of referenced | ||
* identifiers. | ||
*/ | ||
export function extractPublicIdentifiers(filePaths: string[]): Set<string> { | ||
const publicIdentifiers = new Set<string>(); | ||
|
||
for (const filePath of filePaths) { | ||
const contents = fs.readFileSync(filePath, { encoding: 'UTF-8' }); | ||
const sourceFile = ts.createSourceFile( | ||
filePath, | ||
contents, | ||
ts.ScriptTarget.ES2015 | ||
); | ||
|
||
const identifiers = new Set<string>(); | ||
ts.forEachChild(sourceFile, (childNode: ts.Node) => | ||
extractIdentifiersFromNodeAndChildren(childNode, identifiers) | ||
); | ||
|
||
identifiers.forEach(api => { | ||
publicIdentifiers.add(api); | ||
}); | ||
} | ||
|
||
return publicIdentifiers; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.