Skip to content

Commit

Permalink
chore: npm update
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulthink committed Sep 28, 2023
1 parent 172fa2a commit 1ebff88
Show file tree
Hide file tree
Showing 9 changed files with 4,329 additions and 14,597 deletions.
Empty file added .local/notes.md
Empty file.
9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
*/

module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
},
export default {
roots: ["<rootDir>"],
preset: "ts-jest",
testEnvironment: "jsdom",
testPathIgnorePatterns: ["/node_modules/", "/dist/", "/__utils__/"],
collectCoverage: true,
coverageThreshold: {
global: {
Expand Down
18,824 changes: 4,255 additions & 14,569 deletions package-lock.json

Large diffs are not rendered by default.

43 changes: 24 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@googlemaps/js-api-loader",
"version": "1.16.2",
"type": "module",
"description": "Wrapper for the loading of Google Maps JavaScript API script in the browser",
"keywords": [
"google",
Expand Down Expand Up @@ -33,38 +34,42 @@
"test:e2e": "jest e2e/*"
},
"dependencies": {
"@rollup/plugin-terser": "^0.4.3",
"fast-deep-equal": "^3.1.3"
},
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@babel/runtime-corejs3": "^7.9.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-typescript": "^8.3.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-typescript": "^11.1.4",
"@types/google.maps": "^3.53.1",
"@types/jest": "^27.0.1",
"@types/jest": "^29.5.5",
"@types/selenium-webdriver": "^4.0.9",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"chromedriver": "^101.0.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"chromedriver": "^117.0.3",
"core-js": "^3.6.4",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.1.3",
"eslint-plugin-prettier": "^4.0.0",
"geckodriver": "^3.0.1",
"jest": "^26.6.3",
"prettier": "^2.6.2",
"rollup": "^2.4.0",
"rollup-plugin-terser": "^7.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.4.0",
"eslint-plugin-prettier": "^5.0.0",
"geckodriver": "^4.2.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.0.3",
"rollup": "^3.29.3",
"selenium-webdriver": "^4.0.0-alpha.7",
"ts-jest": "^26.5.2",
"typedoc": "^0.22.4",
"typescript": "^4.2.2"
"ts-jest": "^29.1.1",
"typedoc": "^0.25.1",
"typescript": "^5.2.2"
},
"publishConfig": {
"access": "public",
"registry": "https://wombat-dressing-room.appspot.com"
},
"prettier": {
"trailingComma": "es5"
}
}
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { babel } from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";

const babelOptions = {
Expand Down
4 changes: 2 additions & 2 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ test("deleteScript removes script tag from head", async () => {

test("importLibrary resolves correctly", async () => {
window.google = { maps: {} } as any;
google.maps.importLibrary = async (name) => ({ [name]: "fake" } as any);
google.maps.importLibrary = async (name) => ({ [name]: "fake" }) as any;

const loader = new Loader({ apiKey: "foo" });
const corePromise = loader.importLibrary("core");
Expand All @@ -438,7 +438,7 @@ test("importLibrary can also set up bootstrap libraries (if bootstrap libraries

test("importLibrary resolves correctly even with different bootstrap libraries", async () => {
window.google = { maps: {} } as any;
google.maps.importLibrary = async (name) => ({ [name]: "fake" } as any);
google.maps.importLibrary = async (name) => ({ [name]: "fake" }) as any;

const loader = new Loader({ apiKey: "foo", libraries: ["places"] });
const corePromise = loader.importLibrary("core");
Expand Down
40 changes: 40 additions & 0 deletions src/retry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
type RetryOptions = {
maxRetries: number;
timeout: number;
};

const timeout = (t: number) =>
new Promise((resolve) => {
setTimeout(resolve, t);
});

export async function retry<T extends (signal: AbortSignal) => any>(
fn: T,
options: RetryOptions
): Promise<ReturnType<T>> {
let numRetries = 0;
const errors = [];

const abortController = new AbortController();

while (numRetries < options.maxRetries) {
try {
return Promise.race([
fn(abortController.signal),
timeout(options.timeout).then(() => {
throw new Error("timeout");
}),
]);
} catch (err) {
errors.push(err);
}

await timeout(2000 * 2 ** numRetries);
numRetries++;
}

const error = new Error("max retries");
error.cause = errors;

throw error;
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"target": "ES6",
"moduleResolution": "node"
},
"include": ["src/**/*"],
"include": ["src/**/*", "e2e/**/*.ts"],
"exclude": ["node_modules", "./dist"]
}
2 changes: 1 addition & 1 deletion typedoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

module.exports = {
export default {
out: "docs",
exclude: ["**/node_modules/**", "**/*.spec.ts", "**/*.test.ts"],
name: "@googlemaps/js-api-loader",
Expand Down

0 comments on commit 1ebff88

Please sign in to comment.