Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser support (take 2) #6821

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Scaffolding for the "browser" platform
  • Loading branch information
kraenhansen committed Aug 16, 2024
commit a0d2a9483fc47da39b8e6a1eed7a1be0c8ea0ce8
4 changes: 3 additions & 1 deletion packages/realm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
"types": "./dist/public-types/index.d.ts",
"main": "./dist/platform/node/index.js",
"react-native": "./index.react-native.js",
"browser": "./dist/platform/browser/index.js",
"exports": {
".": {
"types": "./dist/public-types/index.d.ts",
"node": "./dist/platform/node/index.js",
"react-native": "./index.react-native.js"
"react-native": "./index.react-native.js",
"browser": "./dist/platform/browser/index.js"
},
"./experimental/base-url": {
"types": "./dist/public-types/experimental/base-url.d.ts",
Expand Down
29 changes: 29 additions & 0 deletions packages/realm/src/platform/browser/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2024 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

// import "./binding";
// import "./fs";
// import "./device-info";
// import "./sync-proxy-config";
// import "./custom-inspect";
// import "./garbage-collection";

console.log("Hello from Realm!");

import { Realm } from "../../Realm";
export = Realm;
20 changes: 20 additions & 0 deletions packages/realm/tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "@tsconfig/recommended",
"compilerOptions": {
"composite": true,
"outDir": "dist/platform/browser",
"rootDir": "src/platform/browser",
"sourceMap": true,
"resolveJsonModule": true,
"noEmit": false,
"allowImportingTsExtensions": false,
"types": ["@realm/fetch"],
"lib": ["ES2020", "DOM"]
},
"include": [
"src/platform/browser/**/*"
],
"references": [
{ "path": "./tsconfig.shared.json" }
]
}
1 change: 1 addition & 0 deletions packages/realm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{ "path": "./tsconfig.shared.json" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.react-native.json" },
{ "path": "./tsconfig.browser.json" },
{ "path": "./tsconfig.tests.json" },
{ "path": "./tsconfig.scripts.json" },
{ "path": "./tsconfig.public-types.json" }
Expand Down
3 changes: 2 additions & 1 deletion packages/realm/tsconfig.shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"src/tests",
"src/scripts",
"src/platform/node",
"src/platform/react-native"
"src/platform/react-native",
"src/platform/browser"
]
}