Skip to content

Commit 336f2ef

Browse files
Exp build works
1 parent fbc96db commit 336f2ef

File tree

9 files changed

+58
-39
lines changed

9 files changed

+58
-39
lines changed

packages/firestore/exp/api-extractor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "../../../config/api-extractor.json",
3-
"mainEntryPointFilePath": "../dist/exp/firestore/exp/index.d.ts",
3+
"mainEntryPointFilePath": "../dist/firestore/exp/index.d.ts",
44
"dtsRollup": {
55
"enabled": true,
66
"publicTrimmedFilePath": "../dist/exp/private.d.ts"

packages/firestore/exp/src/api/database.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { _getProvider, _removeServiceInstance } from '@firebase/app-exp';
19-
import { _FirebaseService, FirebaseApp } from '@firebase/app-types-exp';
19+
import { FirebaseApp } from '@firebase/app-types-exp';
2020
import { Provider } from '@firebase/component';
2121

2222
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
@@ -72,8 +72,7 @@ export interface Settings extends LiteSettings {
7272
* Do not call this constructor directly. Instead, use {@link getFirestore()}.
7373
*/
7474
export class FirebaseFirestore
75-
extends LiteFirestore
76-
implements _FirebaseService {
75+
extends LiteFirestore {
7776
readonly _queue = new AsyncQueue();
7877
readonly _persistenceKey: string;
7978

packages/firestore/src/core/bundle.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ import {
2323
fromVersion,
2424
JsonProtoSerializer
2525
} from '../remote/serializer';
26-
import * as bundleProto from '../protos/firestore_bundle_proto';
27-
import { BundleMetadata } from '../protos/firestore_bundle_proto';
28-
import * as api from '../protos/firestore_proto_api';
26+
import {
27+
Document as ProtoDocument,
28+
Timestamp as ProtoTimestamp
29+
} from '../protos/firestore_proto_api';
30+
import {
31+
BundledDocumentMetadata as ProtoBundledDocumentMetadata,
32+
BundleMetadata as ProtoBundleMetadata,
33+
NamedQuery as ProtoNamedQuery
34+
} from '../protos/firestore_bundle_proto';
2935
import { DocumentKey } from '../model/document_key';
3036
import { MaybeDocument, NoDocument } from '../model/document';
3137
import { debugAssert } from '../util/assert';
@@ -70,8 +76,8 @@ export interface NamedQuery {
7076
* itself, if it exists.
7177
*/
7278
interface BundledDocument {
73-
metadata: bundleProto.BundledDocumentMetadata;
74-
document?: api.Document;
79+
metadata: ProtoBundledDocumentMetadata;
80+
document?: ProtoDocument;
7581
}
7682

7783
/**
@@ -107,7 +113,7 @@ export class BundleConverter {
107113
}
108114
}
109115

110-
toSnapshotVersion(time: api.Timestamp): SnapshotVersion {
116+
toSnapshotVersion(time: ProtoTimestamp): SnapshotVersion {
111117
return fromVersion(time);
112118
}
113119
}
@@ -117,7 +123,7 @@ export class BundleConverter {
117123
* loading a bundle.
118124
*/
119125
export function bundleInitialProgress(
120-
metadata: BundleMetadata
126+
metadata: ProtoBundleMetadata
121127
): ApiLoadBundleTaskProgress {
122128
return {
123129
taskState: 'Running',
@@ -133,7 +139,7 @@ export function bundleInitialProgress(
133139
* has succeeded.
134140
*/
135141
export function bundleSuccessProgress(
136-
metadata: BundleMetadata
142+
metadata: ProtoBundleMetadata
137143
): ApiLoadBundleTaskProgress {
138144
return {
139145
taskState: 'Success',
@@ -159,12 +165,12 @@ export class BundleLoader {
159165
/** The current progress of loading */
160166
private progress: ApiLoadBundleTaskProgress;
161167
/** Batched queries to be saved into storage */
162-
private queries: bundleProto.NamedQuery[] = [];
168+
private queries: ProtoNamedQuery[] = [];
163169
/** Batched documents to be saved into storage */
164170
private documents: BundledDocuments = [];
165171

166172
constructor(
167-
private bundleMetadata: bundleProto.BundleMetadata,
173+
private bundleMetadata: ProtoBundleMetadata,
168174
private localStore: LocalStore,
169175
private serializer: JsonProtoSerializer
170176
) {

packages/firestore/src/local/bundle_cache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import { PersistenceTransaction } from './persistence';
1919
import { PersistencePromise } from './persistence_promise';
20-
import * as bundleProto from '../protos/firestore_bundle_proto';
20+
import { BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery} from '../protos/firestore_bundle_proto';
2121
import { Bundle, NamedQuery } from '../core/bundle';
2222

2323
/**
@@ -39,7 +39,7 @@ export interface BundleCache {
3939
*/
4040
saveBundleMetadata(
4141
transaction: PersistenceTransaction,
42-
metadata: bundleProto.BundleMetadata
42+
metadata: ProtoBundleMetadata
4343
): PersistencePromise<void>;
4444

4545
/**
@@ -56,6 +56,6 @@ export interface BundleCache {
5656
*/
5757
saveNamedQuery(
5858
transaction: PersistenceTransaction,
59-
query: bundleProto.NamedQuery
59+
query: ProtoNamedQuery
6060
): PersistencePromise<void>;
6161
}

packages/firestore/src/protos/firestore_bundle_proto.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
* limitations under the License.
1616
*/
1717

18-
import * as api from './firestore_proto_api';
18+
import {StructuredQuery, Timestamp, Document} from './firestore_proto_api';
1919

2020
/** Properties of a BundledQuery. */
2121
export interface BundledQuery {
2222
/** BundledQuery parent */
2323
parent?: string | null;
2424

2525
/** BundledQuery structuredQuery */
26-
structuredQuery?: api.StructuredQuery | null;
26+
structuredQuery?: StructuredQuery | null;
2727

2828
/** BundledQuery limitType */
2929
limitType?: LimitType | null;
@@ -41,7 +41,7 @@ export interface NamedQuery {
4141
bundledQuery?: BundledQuery | null;
4242

4343
/** NamedQuery readTime */
44-
readTime?: api.Timestamp | null;
44+
readTime?: Timestamp | null;
4545
}
4646

4747
/** Properties of a BundledDocumentMetadata. */
@@ -50,7 +50,7 @@ export interface BundledDocumentMetadata {
5050
name?: string | null;
5151

5252
/** BundledDocumentMetadata readTime */
53-
readTime?: api.Timestamp | null;
53+
readTime?: Timestamp | null;
5454

5555
/** BundledDocumentMetadata exists */
5656
exists?: boolean | null;
@@ -65,7 +65,7 @@ export interface BundleMetadata {
6565
id?: string | null;
6666

6767
/** BundleMetadata createTime */
68-
createTime?: api.Timestamp | null;
68+
createTime?: Timestamp | null;
6969

7070
/** BundleMetadata version */
7171
version?: number | null;
@@ -89,5 +89,5 @@ export interface BundleElement {
8989
documentMetadata?: BundledDocumentMetadata | null;
9090

9191
/** BundleElement document */
92-
document?: api.Document | null;
92+
document?: Document | null;
9393
}

scripts/prune-dts/prune-dts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { format, resolveConfig } from 'prettier';
2222
import { expect } from 'chai';
2323
import { describe, it } from 'mocha';
2424

25-
import { pruneDts } from './prune-dts';
25+
import {pruneDts, removeUnusedImports} from './prune-dts';
2626

2727
const testCasesDir = path.resolve(__dirname, 'tests');
2828
const tmpDir = os.tmpdir();
@@ -32,7 +32,7 @@ const testCaseFilterRe = /.*/;
3232

3333
async function runScript(inputFile: string): Promise<string> {
3434
const outputFile = path.resolve(tmpDir, 'output.d.ts');
35-
await pruneDts(inputFile, outputFile);
35+
pruneDts(inputFile, outputFile);
3636
return outputFile;
3737
}
3838

scripts/prune-dts/prune-dts.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import * as yargs from 'yargs';
1919
import * as ts from 'typescript';
2020
import * as fs from 'fs';
21+
import * as path from 'path';
2122
import { ESLint } from 'eslint';
2223

2324
/**
@@ -33,10 +34,10 @@ import { ESLint } from 'eslint';
3334
* @param inputLocation The file path to the .d.ts produced by API explorer.
3435
* @param outputLocation The output location for the pruned .d.ts file.
3536
*/
36-
export async function pruneDts(
37+
export function pruneDts(
3738
inputLocation: string,
3839
outputLocation: string
39-
): Promise<void> {
40+
): void {
4041
const compilerOptions = {};
4142
const host = ts.createCompilerHost(compilerOptions);
4243
const program = ts.createProgram([inputLocation], compilerOptions, host);
@@ -49,24 +50,24 @@ export async function pruneDts(
4950

5051
const content = printer.printFile(transformedSourceFile);
5152
fs.writeFileSync(outputLocation, content);
52-
53-
await removeUnusedImports(outputLocation);
5453
}
5554

56-
async function removeUnusedImports(outputLocation: string): Promise<void> {
55+
export async function removeUnusedImports(outputLocation: string): Promise<void> {
5756
const eslint = new ESLint({
5857
fix: true,
59-
baseConfig: {
60-
'parserOptions': {
61-
'ecmaVersion': 2017,
62-
sourceType: 'module'
58+
overrideConfig: {
59+
parserOptions: {
60+
ecmaVersion: 2017,
61+
sourceType: 'module',
62+
tsconfigRootDir: __dirname,
63+
project: ["./tsconfig.eslint.json"],
6364
},
64-
'env': {
65-
'es6': true
65+
env: {
66+
es6: true
6667
},
67-
'plugins': ['unused-imports', '@typescript-eslint'],
68-
'parser': '@typescript-eslint/parser',
69-
'rules': {
68+
plugins: ['unused-imports', '@typescript-eslint'],
69+
parser: '@typescript-eslint/parser',
70+
rules: {
7071
'unused-imports/no-unused-imports-ts': ['error']
7172
}
7273
}
@@ -432,5 +433,8 @@ const argv = yargs.options({
432433
}).argv;
433434

434435
if (argv.input && argv.output) {
436+
console.log("Removing private exports...");
435437
pruneDts(argv.input, argv.output);
438+
console.log("Removing unused imports...");
439+
removeUnusedImports(argv.output).then(() => console.log("Done."));
436440
}

scripts/prune-dts/tests/firestore.output.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
import { DocumentData as DocumentData_2 } from '@firebase/firestore-types';
1718
import { FirebaseApp } from '@firebase/app-types';
19+
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
20+
import { _FirebaseService } from '@firebase/app-types';
1821
import { LogLevel } from '@firebase/logger';
22+
import { Provider } from '@firebase/component';
23+
import { SetOptions as SetOptions_2 } from '@firebase/firestore-types';
24+
import { SnapshotMetadata as SnapshotMetadata_2 } from '@firebase/firestore-types';
1925
export declare function addDoc<T>(
2026
reference: CollectionReference<T>,
2127
data: T
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../config/tsconfig.base.json",
3+
"include": ["../../**/*.ts"]
4+
}

0 commit comments

Comments
 (0)