Skip to content

Commit

Permalink
Update dependencies (#575)
Browse files Browse the repository at this point in the history
* docs: Update typedoc to 0.22
* chore: Update typescript to 4.4
* fix(bundle): Validate error type in try..catch
* chore: Add .vscode to .gitignore
* test(react): Update jest to 27, dropping now-unneeded prettier
* fix(react): Drop dependency on prop-types; rely on TS types
* chore(react): Update dev-dependency on react to 17
* chore: Update dev-dependency on gh-pages to 3 (no breaking changes)
* chore(dom): Update dev-dependency on jsdom to 17
* test(dom): Silence console logging during tests
* test(bundle): Update sinon to 11
* chore: Update rollup to 2
* chore(react/example): Refresh lockfile with `npm update`
* chore: Refresh lockfile with `npm update`
* chore: Move sinon dev dependency from bundle to root
  • Loading branch information
eemeli authored Oct 25, 2021
1 parent 3526567 commit 35c4560
Show file tree
Hide file tree
Showing 23 changed files with 9,489 additions and 18,903 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
html
.vscode

# Test coverage
.nyc_output
Expand Down
3 changes: 1 addition & 2 deletions fluent-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"npm": ">=7.0.0"
},
"devDependencies": {
"@fluent/dedent": "file:../fluent-dedent",
"sinon": "^4.2.2"
"@fluent/dedent": "file:../fluent-dedent"
}
}
2 changes: 1 addition & 1 deletion fluent-bundle/src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class FluentBundle {
let value = resolveComplexPattern(scope, pattern);
return value.toString(scope);
} catch (err) {
if (scope.errors) {
if (scope.errors && err instanceof Error) {
scope.errors.push(err);
return new FluentNone().toString(scope);
}
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export class Scope {
this.args = args;
}

reportError(error: Error): void {
if (!this.errors) {
reportError(error: unknown): void {
if (!this.errors || !(error instanceof Error)) {
throw error;
}
this.errors.push(error);
Expand Down
13 changes: 7 additions & 6 deletions fluent-bundle/test/constructor_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import {FluentBundle} from '../esm/bundle.js';
import {FluentResource} from '../esm/resource.js';

suite('FluentBundle constructor', function() {
setup(function() {
this.nf = sinon.spy(Intl, 'NumberFormat');
let nfSpy;
setup(() => {
nfSpy = sinon.spy(Intl, 'NumberFormat');
});

teardown(function() {
this.nf.restore();
teardown(() => {
nfSpy.restore();
});

test('accepts a single locale string', function() {
Expand All @@ -29,7 +30,7 @@ suite('FluentBundle constructor', function() {
assert.strictEqual(val, 'Foo 1');
assert.strictEqual(errs.length, 0);

const locale = this.nf.getCall(0).args[0];
const locale = nfSpy.lastCall.args[0];
assert.deepEqual(locale, ['en-US']);
});

Expand All @@ -46,7 +47,7 @@ suite('FluentBundle constructor', function() {
assert.strictEqual(val, 'Foo 1');
assert.strictEqual(errs.length, 0);

const locales = this.nf.getCall(0).args[0];
const locales = nfSpy.lastCall.args[0];
assert.deepEqual(locales, ['de', 'en-US']);
});
});
2 changes: 1 addition & 1 deletion fluent-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@fluent/bundle": "file:../fluent-bundle",
"jsdom": "^15.1.0"
"jsdom": "^17.0.0"
},
"dependencies": {
"cached-iterable": "^0.3"
Expand Down
4 changes: 4 additions & 0 deletions fluent-dom/test/dom_localization_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from "assert";
import sinon from "sinon";
import { FluentBundle, FluentResource } from "@fluent/bundle";
import DOMLocalization from "../esm/dom_localization.js";

Expand All @@ -10,6 +11,9 @@ async function* mockGenerateMessages(resourceIds) {
}

suite("translateFragment", function() {
setup(() => sinon.stub(console, "warn"));
teardown(() => console.warn.restore());

test("translates a node", async function() {
const domLoc = new DOMLocalization(["test.ftl"], mockGenerateMessages);

Expand Down
4 changes: 4 additions & 0 deletions fluent-dom/test/extra_text_markup_test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import assert from 'assert';
import sinon from 'sinon';
import translateElement from '../esm/overlay.js';
import {elem} from './util.js';

suite('Localized text markup', function() {
setup(() => sinon.stub(console, 'warn'));
teardown(() => console.warn.restore());

test('allowed element', function() {
const element = elem('div')`Foo`;
const translation = {
Expand Down
4 changes: 4 additions & 0 deletions fluent-dom/test/localization_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from "assert";
import sinon from "sinon";
import { FluentBundle, FluentResource } from "@fluent/bundle";
import Localization from "../esm/localization.js";

Expand All @@ -10,6 +11,9 @@ async function* mockGenerateMessages(resourceIds) {
}

suite("formatMessages", function() {
setup(() => sinon.stub(console, "warn"));
teardown(() => console.warn.restore());

test("returns a translation", async function() {
const loc = new Localization(["test.ftl"], mockGenerateMessages);
const translations = await loc.formatMessages([{id: "key1"}]);
Expand Down
7 changes: 7 additions & 0 deletions fluent-dom/test/overlay_functional_children_test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import assert from 'assert';
import sinon from 'sinon';
import translateElement from '../esm/overlay.js';
import {elem} from './util.js';

suite('Child without name', function() {
setup(() => sinon.stub(console, 'warn'));
teardown(() => console.warn.restore());

test('in source', function() {
const element = elem('div')`
<button>Foo</button>`;
Expand Down Expand Up @@ -49,6 +53,9 @@ suite('Child without name', function() {
});

suite('Child with name', function() {
setup(() => sinon.stub(console, 'warn'));
teardown(() => console.warn.restore());

test('in source', function() {
const element = elem('div')`
<button data-l10n-name="foo">Foo</button>`;
Expand Down
4 changes: 4 additions & 0 deletions fluent-dom/test/overlay_text_children_test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import assert from 'assert';
import sinon from 'sinon';
import translateElement from '../esm/overlay.js';
import {elem} from './util.js';

suite('Text-semantic argument elements', function() {
setup(() => sinon.stub(console, 'warn'));
teardown(() => console.warn.restore());

test('without data-l10n-name', function() {
const element = elem('div')`
<em class="bar"></em>`;
Expand Down
2 changes: 1 addition & 1 deletion fluent-gecko/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"docs": "true"
},
"devDependencies": {
"rollup-plugin-node-resolve": "^4.2.2"
"@rollup/plugin-node-resolve": "^13.0.4"
}
}
4 changes: 2 additions & 2 deletions fluent-gecko/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync } from "fs";
import nodeResolve from "rollup-plugin-node-resolve";
import { nodeResolve } from '@rollup/plugin-node-resolve';

const vim = `/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */`;
const license = `\
Expand Down Expand Up @@ -36,7 +36,7 @@ export default [
intro: `/* fluent-react@${reactPkg.version} */`,
},
context: "this",
external: ["react", "prop-types"],
external: ["react"],
plugins: [nodeResolve()],
},
{
Expand Down
Loading

0 comments on commit 35c4560

Please sign in to comment.