Skip to content

Commit

Permalink
Merged with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
yasharpm committed Jul 20, 2024
2 parents 6075b69 + 9999f23 commit 818f0ce
Show file tree
Hide file tree
Showing 19 changed files with 36,369 additions and 47,166 deletions.
1 change: 0 additions & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

cover 99.5%
ie >= 11
maintained node versions
not dead
6 changes: 3 additions & 3 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
strategy:
matrix:
# Support LTS versions based on https://nodejs.org/en/about/releases/
node-version: ['14', '16']
node-version: ['18', '20']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Many thanks to @iLiviu for contributing all fixes in this release!
* `RemoteStorage.defineModule` is no more, and both declaring modules and
loading them in apps can now be done with a new, improved API. (#974)
* The connect widget is not part of the core library anymore, but has moved to
a seperate add-on library (#862)
a separate add-on library (#862)
* Error events (e.g. unauthorized, sync error, etc.) are identified by name
instead of type now (#984)
* Network request timeouts are configured via the `setRequestTimeout` method
Expand Down
2 changes: 1 addition & 1 deletion doc/contributing/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ Production
This creates the minified production build in ``release/``.

It also creates a seperate source maps file, which you can link to in case you
It also creates a separate source maps file, which you can link to in case you
want to (e.g. to improve exception tracking/debugging in production).
8 changes: 4 additions & 4 deletions doc/contributing/code-overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ repo. These are built into a single file in the ``release/`` folder using
and are based on `Jaribu <https://github.com/silverbucket/jaribu>`_.

The structure of the code is based around feature loading. Most files in
``src/`` correspond to a feature, e.g. ``discover.js`` to
``RemoteStorage.Discover`` or ``caching.js`` to ``RemoteStorage.Caching``.
``src/`` correspond to a feature, e.g. ``discover.ts`` to
``RemoteStorage.Discover`` or ``caching.ts`` to ``RemoteStorage.Caching``.

The feature loading happens synchronously during the page load in
``src/remotestorage.js`` (just including this script in your app will lead to
``src/remotestorage.ts`` (just including this script in your app will lead to
executing the code that loads the features).

Most features load under their own name, but for ``remoteStorage.local`` a
Expand All @@ -22,7 +22,7 @@ supports.

For ``remoteStorage.local`` we then also have a `special mixin
<https://github.com/remotestorage/remotestorage.js/issues/777#issuecomment-57392440>`__
called ``src/cachinglayer.js``, which mixes in some common functions into the
called ``src/cachinglayer.ts``, which mixes in some common functions into the
object.

The ``remoteStorage.remote`` feature is not loaded immediately, but only when
Expand Down
4 changes: 2 additions & 2 deletions doc/data-modules/defining-data-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ errors in case the data format doesn't match::
.. HINT::
JSON Schema is very powerful and flexible. If you want to learn more about
it, check out the free e-book `Understanding JSON
Schema <https://spacetelescope.github.io/understanding-json-schema/>`_ for
Schema <https://json-schema.org/understanding-json-schema>`_ for
example. The complete official specs can be found at
http://json-schema.org/documentation.html
https://json-schema.org/specification

.. _JSON Schema: http://json-schema.org
13,097 changes: 629 additions & 12,468 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
"ts-node": "^10.9.1",
"typedoc": "^0.19.2",
"typescript": "^4.8.3",
"webpack": "^4.46.0",
"webpack-cli": "^4.10.0"
"webpack": "^5.92.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@inrupt/solid-client": "^1.30.2",
"@inrupt/solid-client-authn-browser": "^1.17.5",
"@inrupt/vocab-common-rdf": "^1.0.5",
"@inrupt/vocab-solid": "^1.0.4",
"@types/node": "16.11.59",
"@types/node": "20.14.0",
"@types/tv4": "^1.2.29",
"blob": "^0.1.0",
"buffer": "^6.0.3",
Expand Down
69,945 changes: 35,570 additions & 34,375 deletions release/remotestorage.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/remotestorage.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import log from './log';
import { globalContext, localStorageAvailable } from './util';

// feature detection flags
let haveXMLHttpRequest, hasLocalStorage;
let hasLocalStorage;

// used to store settings in localStorage
const SETTINGS_KEY = 'remotestorage:discover';
Expand Down Expand Up @@ -66,7 +66,7 @@ const Discover = function Discover(userAddress: string): Promise<StorageInfo> {
};

if (hasLocalStorage) {
localStorage[SETTINGS_KEY] = JSON.stringify({ cache: cachedInfo });
localStorage.setItem(SETTINGS_KEY, JSON.stringify({ cache: cachedInfo }));
}

return resolve(cachedInfo[userAddress]);
Expand Down Expand Up @@ -95,8 +95,8 @@ Discover._rs_init = function (/*remoteStorage*/): void {
};

Discover._rs_supported = function (): boolean {
haveXMLHttpRequest = Object.prototype.hasOwnProperty.call(globalContext, 'XMLHttpRequest');
return haveXMLHttpRequest;
return Object.prototype.hasOwnProperty.call(globalContext, 'fetch') ||
Object.prototype.hasOwnProperty.call(globalContext, 'XMLHttpRequest');
};

Discover._rs_cleanup = function (): void {
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const shouldBeTreatedAsBinary = (content: string | ArrayBuffer, mimeType:
*/
export const getTextFromArrayBuffer = (arrayBuffer: ArrayBuffer, encoding): Promise<string | ArrayBuffer> => {
return new Promise((resolve/*, reject*/) => {
if (typeof Blob === 'undefined') {
if (typeof Blob === 'undefined' || typeof FileReader === 'undefined') {
const buffer = Buffer.from(arrayBuffer);
resolve(buffer.toString(encoding));
} else {
Expand Down
7 changes: 3 additions & 4 deletions test/helpers/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ class MockLocation {
}
}


export default function locationFactory(url) {
if (!('document' in global)) {
global["document"] = {} as Document;
if (!('document' in globalThis)) {
globalThis["document"] = {} as Document;
}
global.document.location = new MockLocation(url) as unknown as Location;
globalThis.document.location = new MockLocation(url) as unknown as Location;
}
6 changes: 3 additions & 3 deletions test/unit/authorize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class MockRemote extends RemoteBase implements Remote {
}

locationFactory('https://foo/bar');
global.localStorageAvailable = localStorageAvailable;
global["sessionStorage"] = sessionStorage;
globalThis.localStorageAvailable = localStorageAvailable;
globalThis["sessionStorage"] = sessionStorage;

describe("authorization", () => {
const sandbox = sinon.createSandbox();
Expand All @@ -54,7 +54,7 @@ describe("authorization", () => {
sessionStorage.removeItem('remotestorage:codeVerifier');
sessionStorage.removeItem('remotestorage:state');

global.document.location.href = 'https://foo/bar';
globalThis.document.location.href = 'https://foo/bar';
});

afterEach(() => {
Expand Down
Loading

0 comments on commit 818f0ce

Please sign in to comment.