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

CommonJS bundle (without Rollup) #5853

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7bd4c0e
Using tsc to build instead of rollup
kraenhansen May 26, 2023
f35276b
Using default import of Realm in tests
kraenhansen May 26, 2023
586b1f6
Adding missing NS exports
kraenhansen May 26, 2023
367ca90
Renamed "realm:bundle" to "realm:build:ts"
kraenhansen May 30, 2023
f467de0
Fixing wireit deps for "build:ts"
kraenhansen May 30, 2023
72ff354
Using inline source maps
kraenhansen May 30, 2023
d2195f2
Updated nyc config to reflect us using tsc
kraenhansen May 30, 2023
4c637c8
Moved realm:build:ts to build-dependencies
kraenhansen May 30, 2023
2325ab5
Removing code coverage
kraenhansen May 31, 2023
18c3b1e
Using source maps files
kraenhansen May 31, 2023
ac046b9
Introducing "GENERATED_OUTPUT_DIR" to CMakeLists.txt
kraenhansen May 31, 2023
7550498
Generating public types with internals stripped
kraenhansen Jun 2, 2023
ef7ac59
Fixing CMakeLists.txt
kraenhansen Jun 6, 2023
6a8ad90
Invoking cmake from package.json scripts to generate TS and wrappers
kraenhansen Jun 6, 2023
8b66de0
Fixed CMakeLists.txt
kraenhansen Jun 7, 2023
0db66d0
Re-arranged scripts in SDK package
kraenhansen Jun 7, 2023
d83f22a
Fixed importing through "realm/binding/core"
kraenhansen Jun 7, 2023
cffdcba
Build ts pre-testing to allow "realm/binding/core"
kraenhansen Jun 7, 2023
a050c03
Using AnyUser in SyncConfiguration
kraenhansen Jun 7, 2023
5e7e9a7
Adjusted the location of the prebuilt
kraenhansen Jun 7, 2023
37164a4
Renamed cjs.ts to index.cjs.ts
kraenhansen Jun 8, 2023
511bd95
Generating all .js and .ts into src/generated and realm.node into the…
kraenhansen Jun 9, 2023
a7a2158
Working around https://github.com/microsoft/TypeScript/issues/54573
kraenhansen Jun 9, 2023
7280d8c
Fixed @realm/react tests
kraenhansen Jun 9, 2023
923206a
Removed nyc
kraenhansen Jun 9, 2023
88c9e4e
Merge branch 'main' into kh/cjs-bundle
kraenhansen Jun 9, 2023
c5a6fb6
Update package.json
kraenhansen Jun 9, 2023
6e72b4e
Exposing PropertyTypeName to fix @realm/babel-plugin tests
kraenhansen Jun 10, 2023
4e3c150
Exposing NumericLogLevel and WaitForSync on Realm
kraenhansen Jun 10, 2023
6cfd781
Exposing SubscriptionSetState
kraenhansen Jun 10, 2023
d175251
package-lock updated
kraenhansen Jun 10, 2023
ced8b15
Adding polyfills for conditional exports
kraenhansen Jun 10, 2023
2100075
Moved binding to @realm/binding
kraenhansen Jun 11, 2023
526a8af
Adding the task to configure cmake
kraenhansen Jun 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:

jobs:
run:
# Disabled until https://github.com/istanbuljs/nyc/issues/1448 is fixed or we find a workaround
if: false
name: Build and tests with coverage
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ coverage/

# Generated artifacts
/packages/realm/bindgen/vendor/bindgen-lib/generated/
/packages/realm/generated/
/packages/realm/binding/src/generated/

# Build artifacts
/packages/realm/realm.node
/packages/realm/dist/
/packages/realm/binding/dist/
/packages/realm/prebuilds/
/packages/realm/react-native/android/src/main/java/io/realm/react/Version.java
/packages/realm/react-native/android/src/main/jniLibs/
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/environments/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test:main": {
"command": "mocha-remote --reporter @realm/mocha-reporter --id main tsx runner.ts main",
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
Expand All @@ -34,7 +34,7 @@
"test:renderer": {
"command": "mocha-remote --reporter @realm/mocha-reporter --id renderer tsx runner.ts renderer",
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/environments/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": {
"command": "mocha-remote --reporter @realm/mocha-reporter tsx index.mjs",
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
Expand All @@ -22,7 +22,7 @@
"test:commonjs": {
"command": "mocha-remote --reporter @realm/mocha-reporter tsx index.cjs",
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/environments/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"command": "npm run common",
"dependencies": [
"../../../packages/realm:build:android",
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
],
Expand All @@ -106,7 +106,7 @@
"command": "npm run common",
"dependencies": [
"pod-install:simulator",
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
],
Expand All @@ -119,7 +119,7 @@
"command": "npm run common",
"dependencies": [
"pod-install:catalyst",
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
],
Expand All @@ -132,7 +132,7 @@
"command": "npm run common",
"dependencies": [
"../../../packages/realm:build:android",
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
],
Expand All @@ -146,7 +146,7 @@
"dependencies": [
"pod-install:simulator",
"../../../packages/realm:build:ios:debug:simulator",
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
],
Expand All @@ -160,7 +160,7 @@
"dependencies": [
"pod-install:catalyst",
"../../../packages/realm:build:ios:debug:catalyst",
"../../../packages/realm:bundle",
"../../../packages/realm:build:ts",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
],
Expand Down
8 changes: 0 additions & 8 deletions integration-tests/tests/.nycrc.json

This file was deleted.

24 changes: 2 additions & 22 deletions integration-tests/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,30 @@
"build": "wireit",
"start": "wireit",
"test": "wireit",
"lint": "eslint --ext .js,.ts .",
"coverage": "wireit",
"ci:coverage": "wireit"
"lint": "eslint --ext .js,.ts ."
},
"wireit": {
"build": {
"command": "tsc",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"start": {
"command": "mocha --watch",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"test": {
"command": "mocha --exit",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"coverage": {
"command": "nyc mocha --exit",
"dependencies": [
"../../packages/realm:bundle:coverage",
"build-dependencies"
]
},
"ci:coverage": {
"command": "nyc --reporter=lcov -- mocha --exit",
"dependencies": [
"../../packages/realm:bundle:coverage",
"build-dependencies"
]
},
"build-dependencies": {
"dependencies": [
"../../packages/realm:build:ts",
"../../packages/realm:build:node",
"../../packages/mocha-reporter:bundle",
"../../packages/realm-network-transport:bundle"
Expand All @@ -64,7 +46,6 @@
"realm": "*"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@realm/app-importer": "*",
"@realm/mocha-reporter": "*",
"@thi.ng/bench": "^3.1.16",
Expand All @@ -76,7 +57,6 @@
"concurrently": "^6.5.1",
"mocha": "^10.1.0",
"node-fetch": "^2.6.9",
"nyc": "^15.1.0",
"platform": "^1.3.6",
"realm": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/hooks/import-app-before.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////

import { Realm, AppConfiguration } from "realm";
import Realm, { AppConfiguration } from "realm";

import { importApp } from "../utils/import-app";
import { AppConfig } from "@realm/app-importer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////

import { Realm } from "realm";
import Realm from "realm";

import { describePerformance } from "../utils/benchmark";

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/schemas/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

/* tslint:disable max-classes-per-file */

import { Realm } from "realm";
import Realm from "realm";

export interface IContact {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

/* tslint:disable max-classes-per-file */

import { Realm } from "realm";
import Realm from "realm";

export interface IPerson {
_id: Realm.BSON.ObjectId;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/schemas/person-and-dogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

/* tslint:disable max-classes-per-file */

import { Realm } from "realm";
import Realm from "realm";

export interface IPerson {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/setup-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("Test Harness", function (this: Mocha.Suite) {
Context.prototype.longTimeout = longTimeout;
});

import { Realm } from "realm";
import Realm from "realm";

// Disable the logger to avoid console flooding
const { defaultLogLevel = "off" } = environment;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/class-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

import { openRealmBeforeEach } from "../hooks";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";
import { openRealmBeforeEach } from "../hooks";

import { PersonSchema, DogSchema } from "../schemas/person-and-dogs";
Expand Down
10 changes: 10 additions & 0 deletions integration-tests/tests/src/tests/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
OpenRealmBehaviorType,
OpenRealmTimeOutBehavior,
SessionStopPolicy,
WaitForSync,
} from "realm";

describe("Enums", function () {
Expand Down Expand Up @@ -84,4 +85,13 @@ describe("Enums", function () {
});
});
});
describe("WaitForSync", function () {
it("is accessible", function () {
expect(WaitForSync).deep.equals({
Always: "always",
FirstTime: "first-time",
Never: "never",
});
});
});
});
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////

import { Realm, BSON } from "realm";
import Realm, { BSON } from "realm";
import { expectArraysEqual, expectSimilar } from "../utils/comparisons";
import { expect } from "chai";
import { CanonicalObjectSchema } from "realm";
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";
import { openRealmBeforeEach } from "../hooks";

import { PersonSchema, DogSchema } from "../schemas/person-and-dogs";
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////
import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

import { IPerson, Person, PersonSchema } from "../schemas/person-and-dogs";
import {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/realm-constructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

import { IPerson, PersonSchema, DogSchema } from "../schemas/person-and-dogs";

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import { expect } from "chai";
import { openRealmBefore } from "../hooks";
import { Realm } from "realm";
import Realm from "realm";

interface Test {
primary: number;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

type DefaultObject = Record<string, unknown>;

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

import { openRealmBefore } from "../hooks";

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/shared-realms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm, List } from "realm";
import Realm, { List } from "realm";

import { openRealmBefore, openRealmBeforeEach } from "../hooks";
import { createLocalConfig } from "../utils/open-realm";
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/tests/src/tests/sync/flexible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
// fraction too long.

import { expect } from "chai";
import {
import Realm, {
BSON,
ClientResetMode,
ConfigurationWithSync,
ErrorCallback,
FlexibleSyncConfiguration,
Realm,
SessionStopPolicy,
SubscriptionSetState,
CompensatingWriteError,
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/sync/mixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////
import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

import { importAppBefore, authenticateUserBefore, openRealmBefore } from "../../hooks";

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/src/tests/sync/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import { Realm } from "realm";
import Realm from "realm";

import { authenticateUserBefore, importAppBefore } from "../../hooks";
import { buildAppConfig } from "../../utils/build-app-config";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////

import { Realm, BSON } from "realm";
import Realm, { BSON } from "realm";
import { expect } from "chai";
import { importAppBefore } from "../../hooks";
import { getRegisteredEmailPassCredentials } from "../../utils/credentials";
Expand Down
Loading