Skip to content

Commit 429c139

Browse files
committed
Run prettier on whole repo
1 parent 95ab732 commit 429c139

File tree

8 files changed

+410
-17
lines changed

8 files changed

+410
-17
lines changed

integration/messaging/test/test-send.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ describe('Starting Integration Test > Sending and Receiving ', function () {
6767
}
6868

6969
TEST_DOMAINS.forEach(domain => {
70-
describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${domain}`, function() {
71-
before(async function() {
70+
describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${domain}`, function () {
71+
before(async function () {
7272
globalWebDriver = createPermittedWebDriver(
7373
/* browser= */ assistantBrowser.getId()
7474
);
7575
});
7676

77-
it('Background app can receive a {} empty message from sw', async function() {
77+
it('Background app can receive a {} empty message from sw', async function () {
7878
this.timeout(TIMEOUT_BACKGROUND_MESSAGE_TEST_UNIT_MILLISECONDS);
7979

8080
// Clearing the cache and db data by killing the previously instantiated driver. Note that
@@ -107,7 +107,7 @@ describe('Starting Integration Test > Sending and Receiving ', function () {
107107
);
108108
});
109109

110-
it('Background app can receive a {"data"} message frow sw', async function() {
110+
it('Background app can receive a {"data"} message frow sw', async function () {
111111
this.timeout(TIMEOUT_BACKGROUND_MESSAGE_TEST_UNIT_MILLISECONDS);
112112

113113
await seleniumAssistant.killWebDriver(globalWebDriver);
@@ -135,7 +135,6 @@ describe('Starting Integration Test > Sending and Receiving ', function () {
135135
/* expectedDataPayload= */ getTestDataPayload()
136136
);
137137
});
138-
139138
});
140139

141140
it('Foreground app can receive a {} empty message in onMessage', async function () {

packages/firestore/lite/src/api/field_value.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import { ParseContext } from '../../../src/api/user_data_reader';
3030
import { FieldTransform } from '../../../src/model/mutation';
3131

3232
/** The public FieldValue class of the lite API. */
33-
export abstract class FieldValue extends SerializableFieldValue
33+
export abstract class FieldValue
34+
extends SerializableFieldValue
3435
implements firestore.FieldValue {}
3536

3637
/**

packages/firestore/scripts/build-bundle.js

Lines changed: 185 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
/**
33
* @license
44
* Copyright 2020 Google LLC
@@ -14,4 +14,187 @@
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17-
*/var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};exports.__esModule=true;var yargs=require("yargs");var rollup_1=require("rollup");var typescriptPlugin=require("rollup-plugin-typescript2");var alias=require("@rollup/plugin-alias");var json=require("rollup-plugin-json");var util=require("../rollup.shared");var argv=yargs.options({input:{type:"string",demandOption:true,desc:"The location of the index.ts file"},output:{type:"string",demandOption:true,desc:"The location for the transpiled JavaScript bundle"}}).argv;function buildBundle(input,output){return __awaiter(this,void 0,void 0,(function(){var bundle;return __generator(this,(function(_a){switch(_a.label){case 0:return[4,rollup_1.rollup({input:input,plugins:[alias(util.generateAliasConfig("node")),typescriptPlugin({tsconfigOverride:{compilerOptions:{target:"es2017"}},transformers:[util.removeAssertTransformer]}),json({preferConst:true})],external:util.resolveNodeExterns})];case 1:bundle=_a.sent();return[4,bundle.write({file:output,format:"es"})];case 2:_a.sent();return[2]}}))}))}buildBundle(argv.input,argv.output);
17+
*/ var __awaiter =
18+
(this && this.__awaiter) ||
19+
function (thisArg, _arguments, P, generator) {
20+
function adopt(value) {
21+
return value instanceof P
22+
? value
23+
: new P(function (resolve) {
24+
resolve(value);
25+
});
26+
}
27+
return new (P || (P = Promise))(function (resolve, reject) {
28+
function fulfilled(value) {
29+
try {
30+
step(generator.next(value));
31+
} catch (e) {
32+
reject(e);
33+
}
34+
}
35+
function rejected(value) {
36+
try {
37+
step(generator['throw'](value));
38+
} catch (e) {
39+
reject(e);
40+
}
41+
}
42+
function step(result) {
43+
result.done
44+
? resolve(result.value)
45+
: adopt(result.value).then(fulfilled, rejected);
46+
}
47+
step((generator = generator.apply(thisArg, _arguments || [])).next());
48+
});
49+
};
50+
var __generator =
51+
(this && this.__generator) ||
52+
function (thisArg, body) {
53+
var _ = {
54+
label: 0,
55+
sent: function () {
56+
if (t[0] & 1) throw t[1];
57+
return t[1];
58+
},
59+
trys: [],
60+
ops: []
61+
},
62+
f,
63+
y,
64+
t,
65+
g;
66+
return (
67+
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
68+
typeof Symbol === 'function' &&
69+
(g[Symbol.iterator] = function () {
70+
return this;
71+
}),
72+
g
73+
);
74+
function verb(n) {
75+
return function (v) {
76+
return step([n, v]);
77+
};
78+
}
79+
function step(op) {
80+
if (f) throw new TypeError('Generator is already executing.');
81+
while (_)
82+
try {
83+
if (
84+
((f = 1),
85+
y &&
86+
(t =
87+
op[0] & 2
88+
? y['return']
89+
: op[0]
90+
? y['throw'] || ((t = y['return']) && t.call(y), 0)
91+
: y.next) &&
92+
!(t = t.call(y, op[1])).done)
93+
)
94+
return t;
95+
if (((y = 0), t)) op = [op[0] & 2, t.value];
96+
switch (op[0]) {
97+
case 0:
98+
case 1:
99+
t = op;
100+
break;
101+
case 4:
102+
_.label++;
103+
return { value: op[1], done: false };
104+
case 5:
105+
_.label++;
106+
y = op[1];
107+
op = [0];
108+
continue;
109+
case 7:
110+
op = _.ops.pop();
111+
_.trys.pop();
112+
continue;
113+
default:
114+
if (
115+
!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
116+
(op[0] === 6 || op[0] === 2)
117+
) {
118+
_ = 0;
119+
continue;
120+
}
121+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
122+
_.label = op[1];
123+
break;
124+
}
125+
if (op[0] === 6 && _.label < t[1]) {
126+
_.label = t[1];
127+
t = op;
128+
break;
129+
}
130+
if (t && _.label < t[2]) {
131+
_.label = t[2];
132+
_.ops.push(op);
133+
break;
134+
}
135+
if (t[2]) _.ops.pop();
136+
_.trys.pop();
137+
continue;
138+
}
139+
op = body.call(thisArg, _);
140+
} catch (e) {
141+
op = [6, e];
142+
y = 0;
143+
} finally {
144+
f = t = 0;
145+
}
146+
if (op[0] & 5) throw op[1];
147+
return { value: op[0] ? op[1] : void 0, done: true };
148+
}
149+
};
150+
exports.__esModule = true;
151+
var yargs = require('yargs');
152+
var rollup_1 = require('rollup');
153+
var typescriptPlugin = require('rollup-plugin-typescript2');
154+
var alias = require('@rollup/plugin-alias');
155+
var json = require('rollup-plugin-json');
156+
var util = require('../rollup.shared');
157+
var argv = yargs.options({
158+
input: {
159+
type: 'string',
160+
demandOption: true,
161+
desc: 'The location of the index.ts file'
162+
},
163+
output: {
164+
type: 'string',
165+
demandOption: true,
166+
desc: 'The location for the transpiled JavaScript bundle'
167+
}
168+
}).argv;
169+
function buildBundle(input, output) {
170+
return __awaiter(this, void 0, void 0, function () {
171+
var bundle;
172+
return __generator(this, function (_a) {
173+
switch (_a.label) {
174+
case 0:
175+
return [
176+
4,
177+
rollup_1.rollup({
178+
input: input,
179+
plugins: [
180+
alias(util.generateAliasConfig('node')),
181+
typescriptPlugin({
182+
tsconfigOverride: { compilerOptions: { target: 'es2017' } },
183+
transformers: [util.removeAssertTransformer]
184+
}),
185+
json({ preferConst: true })
186+
],
187+
external: util.resolveNodeExterns
188+
})
189+
];
190+
case 1:
191+
bundle = _a.sent();
192+
return [4, bundle.write({ file: output, format: 'es' })];
193+
case 2:
194+
_a.sent();
195+
return [2];
196+
}
197+
});
198+
});
199+
}
200+
buildBundle(argv.input, argv.output);

packages/firestore/scripts/extract-api.js

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
/**
33
* @license
44
* Copyright 2020 Google LLC
@@ -14,4 +14,58 @@
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17-
*/exports.__esModule=true;exports.extractPublicIdentifiers=void 0;var ts=require("typescript");var fs=require("fs");function extractIdentifiersFromNodeAndChildren(node,symbols){if(ts.isIdentifier(node)){symbols.add(node.escapedText.toString())}ts.forEachChild(node,(function(childNode){return extractIdentifiersFromNodeAndChildren(childNode,symbols)}))}function extractTypeDeclaration(fileName){var result;var compilerOptions={declaration:true,emitDeclarationOnly:true};var host=ts.createCompilerHost(compilerOptions);host.writeFile=function(_,contents){return result=contents};var program=ts.createProgram([fileName],compilerOptions,host);program.emit();return result}function extractPublicIdentifiers(filePaths){var publicIdentifiers=new Set;var _loop_1=function(filePath){var contents=fs.readFileSync(filePath,{encoding:"utf-8"});var sourceFile=ts.createSourceFile(filePath,contents,ts.ScriptTarget.ES2015);if(!sourceFile.isDeclarationFile){var dtsSource=extractTypeDeclaration(filePath);sourceFile=ts.createSourceFile(filePath.replace(".ts",".d.ts"),dtsSource,ts.ScriptTarget.ES2015)}var identifiers=new Set;ts.forEachChild(sourceFile,(function(childNode){return extractIdentifiersFromNodeAndChildren(childNode,identifiers)}));identifiers.forEach((function(api){publicIdentifiers.add(api)}))};for(var _i=0,filePaths_1=filePaths;_i<filePaths_1.length;_i++){var filePath=filePaths_1[_i];_loop_1(filePath)}return publicIdentifiers}exports.extractPublicIdentifiers=extractPublicIdentifiers;
17+
*/ exports.__esModule = true;
18+
exports.extractPublicIdentifiers = void 0;
19+
var ts = require('typescript');
20+
var fs = require('fs');
21+
function extractIdentifiersFromNodeAndChildren(node, symbols) {
22+
if (ts.isIdentifier(node)) {
23+
symbols.add(node.escapedText.toString());
24+
}
25+
ts.forEachChild(node, function (childNode) {
26+
return extractIdentifiersFromNodeAndChildren(childNode, symbols);
27+
});
28+
}
29+
function extractTypeDeclaration(fileName) {
30+
var result;
31+
var compilerOptions = { declaration: true, emitDeclarationOnly: true };
32+
var host = ts.createCompilerHost(compilerOptions);
33+
host.writeFile = function (_, contents) {
34+
return (result = contents);
35+
};
36+
var program = ts.createProgram([fileName], compilerOptions, host);
37+
program.emit();
38+
return result;
39+
}
40+
function extractPublicIdentifiers(filePaths) {
41+
var publicIdentifiers = new Set();
42+
var _loop_1 = function (filePath) {
43+
var contents = fs.readFileSync(filePath, { encoding: 'utf-8' });
44+
var sourceFile = ts.createSourceFile(
45+
filePath,
46+
contents,
47+
ts.ScriptTarget.ES2015
48+
);
49+
if (!sourceFile.isDeclarationFile) {
50+
var dtsSource = extractTypeDeclaration(filePath);
51+
sourceFile = ts.createSourceFile(
52+
filePath.replace('.ts', '.d.ts'),
53+
dtsSource,
54+
ts.ScriptTarget.ES2015
55+
);
56+
}
57+
var identifiers = new Set();
58+
ts.forEachChild(sourceFile, function (childNode) {
59+
return extractIdentifiersFromNodeAndChildren(childNode, identifiers);
60+
});
61+
identifiers.forEach(function (api) {
62+
publicIdentifiers.add(api);
63+
});
64+
};
65+
for (var _i = 0, filePaths_1 = filePaths; _i < filePaths_1.length; _i++) {
66+
var filePath = filePaths_1[_i];
67+
_loop_1(filePath);
68+
}
69+
return publicIdentifiers;
70+
}
71+
exports.extractPublicIdentifiers = extractPublicIdentifiers;

packages/firestore/scripts/remove-asserts.js

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
/**
33
* @license
44
* Copyright 2020 Google LLC
@@ -14,4 +14,66 @@
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17-
*/exports.__esModule=true;exports.removeAsserts=void 0;var ts=require("typescript");var ASSERT_LOCATION="packages/firestore/src/util/assert.ts";function removeAsserts(program){var removeAsserts=new RemoveAsserts(program.getTypeChecker());return function(context){return function(file){return removeAsserts.visitNodeAndChildren(file,context)}}}exports.removeAsserts=removeAsserts;var RemoveAsserts=function(){function RemoveAsserts(typeChecker){this.typeChecker=typeChecker}RemoveAsserts.prototype.visitNodeAndChildren=function(node,context){var _this=this;return ts.visitEachChild(this.visitNode(node),(function(childNode){return _this.visitNodeAndChildren(childNode,context)}),context)};RemoveAsserts.prototype.visitNode=function(node){var updatedNode=null;if(ts.isCallExpression(node)){var signature=this.typeChecker.getResolvedSignature(node);if(signature&&signature.declaration&&signature.declaration.kind===ts.SyntaxKind.FunctionDeclaration){var declaration=signature.declaration;if(declaration&&declaration.getSourceFile().fileName.indexOf(ASSERT_LOCATION)>=0){var method=declaration.name.text;if(method==="debugAssert"){updatedNode=ts.createEmptyStatement()}else if(method==="hardAssert"){updatedNode=ts.createCall(declaration.name,undefined,[node.arguments[0]])}else if(method==="fail"){updatedNode=ts.createCall(declaration.name,undefined,[])}}}}if(updatedNode){ts.setSourceMapRange(updatedNode,ts.getSourceMapRange(node));return updatedNode}else{return node}};return RemoveAsserts}();
17+
*/ exports.__esModule = true;
18+
exports.removeAsserts = void 0;
19+
var ts = require('typescript');
20+
var ASSERT_LOCATION = 'packages/firestore/src/util/assert.ts';
21+
function removeAsserts(program) {
22+
var removeAsserts = new RemoveAsserts(program.getTypeChecker());
23+
return function (context) {
24+
return function (file) {
25+
return removeAsserts.visitNodeAndChildren(file, context);
26+
};
27+
};
28+
}
29+
exports.removeAsserts = removeAsserts;
30+
var RemoveAsserts = (function () {
31+
function RemoveAsserts(typeChecker) {
32+
this.typeChecker = typeChecker;
33+
}
34+
RemoveAsserts.prototype.visitNodeAndChildren = function (node, context) {
35+
var _this = this;
36+
return ts.visitEachChild(
37+
this.visitNode(node),
38+
function (childNode) {
39+
return _this.visitNodeAndChildren(childNode, context);
40+
},
41+
context
42+
);
43+
};
44+
RemoveAsserts.prototype.visitNode = function (node) {
45+
var updatedNode = null;
46+
if (ts.isCallExpression(node)) {
47+
var signature = this.typeChecker.getResolvedSignature(node);
48+
if (
49+
signature &&
50+
signature.declaration &&
51+
signature.declaration.kind === ts.SyntaxKind.FunctionDeclaration
52+
) {
53+
var declaration = signature.declaration;
54+
if (
55+
declaration &&
56+
declaration.getSourceFile().fileName.indexOf(ASSERT_LOCATION) >= 0
57+
) {
58+
var method = declaration.name.text;
59+
if (method === 'debugAssert') {
60+
updatedNode = ts.createEmptyStatement();
61+
} else if (method === 'hardAssert') {
62+
updatedNode = ts.createCall(declaration.name, undefined, [
63+
node.arguments[0]
64+
]);
65+
} else if (method === 'fail') {
66+
updatedNode = ts.createCall(declaration.name, undefined, []);
67+
}
68+
}
69+
}
70+
}
71+
if (updatedNode) {
72+
ts.setSourceMapRange(updatedNode, ts.getSourceMapRange(node));
73+
return updatedNode;
74+
} else {
75+
return node;
76+
}
77+
};
78+
return RemoveAsserts;
79+
})();

0 commit comments

Comments
 (0)