split up project in 4 sub packages in a monorepo

This commit is contained in:
Bruno Windels 2021-10-01 18:19:56 +02:00
parent 39d5073f49
commit fdc59a8e02
415 changed files with 532 additions and 149 deletions

72
old.package.json Normal file
View file

@ -0,0 +1,72 @@
{
"name": "hydrogen-web",
"version": "0.2.16",
"description": "A javascript matrix client prototype, trying to minize RAM usage by offloading as much as possible to IndexedDB",
"main": "src/lib.ts",
"directories": {
"doc": "doc"
},
"scripts": {
"lint": "eslint --cache src/",
"lint-ts": "eslint src/ -c .ts-eslintrc.js --ext .ts",
"lint-ci": "eslint src/",
"test": "impunity --entry-point src/main.js --force-esm-dirs lib/ src/",
"start": "snowpack dev --port 3000",
"build": "node --experimental-modules scripts/build.mjs",
"postinstall": "node ./scripts/post-install.js"
},
"repository": {
"type": "git",
"url": "git@github.com:vector-im/hydrogen-web.git"
},
"author": "matrix.org",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/vector-im/hydrogen-web/issues"
},
"homepage": "https://github.com/vector-im/hydrogen-web/#readme",
"devDependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-multi-entry": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"autoprefixer": "^10.2.6",
"cheerio": "^1.0.0-rc.3",
"commander": "^6.0.0",
"core-js": "^3.6.5",
"eslint": "^7.32.0",
"fake-indexeddb": "^3.1.2",
"finalhandler": "^1.1.1",
"impunity": "^1.0.1",
"mdn-polyfills": "^5.20.0",
"node-html-parser": "^4.0.0",
"postcss": "^8.1.1",
"postcss-css-variables": "^0.17.0",
"postcss-flexbugs-fixes": "^4.2.1",
"postcss-import": "^12.0.1",
"postcss-url": "^8.0.0",
"regenerator-runtime": "^0.13.7",
"rollup-plugin-cleanup": "^3.1.1",
"serve-static": "^1.13.2",
"snowpack": "^3.8.3",
"typescript": "^4.3.5",
"xxhashjs": "^0.2.2"
},
"dependencies": {
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.3.tgz",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"aes-js": "^3.1.2",
"another-json": "^0.2.0",
"base64-arraybuffer": "^0.2.0",
"bs58": "^4.0.1",
"dompurify": "^2.3.0",
"es6-promise": "https://github.com/bwindels/es6-promise.git#bwindels/expose-flush",
"rollup": "^2.26.4",
"text-encoding": "^0.7.0",
"vite": "^2.6.2"
}
}

View file

@ -1,71 +1,9 @@
{
"name": "hydrogen-web",
"version": "0.2.16",
"description": "A javascript matrix client prototype, trying to minize RAM usage by offloading as much as possible to IndexedDB",
"main": "src/lib.ts",
"directories": {
"doc": "doc"
},
"scripts": {
"lint": "eslint --cache src/",
"lint-ts": "eslint src/ -c .ts-eslintrc.js --ext .ts",
"lint-ci": "eslint src/",
"test": "impunity --entry-point src/main.js --force-esm-dirs lib/ src/",
"start": "snowpack dev --port 3000",
"build": "node --experimental-modules scripts/build.mjs",
"postinstall": "node ./scripts/post-install.js"
},
"repository": {
"type": "git",
"url": "git@github.com:vector-im/hydrogen-web.git"
},
"author": "matrix.org",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/vector-im/hydrogen-web/issues"
},
"homepage": "https://github.com/vector-im/hydrogen-web/#readme",
"devDependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-multi-entry": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"autoprefixer": "^10.2.6",
"cheerio": "^1.0.0-rc.3",
"commander": "^6.0.0",
"core-js": "^3.6.5",
"eslint": "^7.32.0",
"fake-indexeddb": "^3.1.2",
"finalhandler": "^1.1.1",
"impunity": "^1.0.1",
"mdn-polyfills": "^5.20.0",
"node-html-parser": "^4.0.0",
"postcss": "^8.1.1",
"postcss-css-variables": "^0.17.0",
"postcss-flexbugs-fixes": "^4.2.1",
"postcss-import": "^12.0.1",
"postcss-url": "^8.0.0",
"regenerator-runtime": "^0.13.7",
"rollup-plugin-cleanup": "^3.1.1",
"serve-static": "^1.13.2",
"snowpack": "^3.8.3",
"typescript": "^4.3.5",
"xxhashjs": "^0.2.2"
},
"dependencies": {
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.3.tgz",
"aes-js": "^3.1.2",
"another-json": "^0.2.0",
"base64-arraybuffer": "^0.2.0",
"bs58": "^4.0.1",
"dompurify": "^2.3.0",
"es6-promise": "https://github.com/bwindels/es6-promise.git#bwindels/expose-flush",
"text-encoding": "^0.7.0",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"rollup": "^2.26.4"
}
"private": true,
"workspaces": [
"packages/common",
"packages/matrix",
"packages/domain",
"packages/web"
]
}

View file

@ -0,0 +1,10 @@
{
"name": "hydrogen-common",
"version": "0.0.1",
"main": "src/lib.ts",
"homepage": "https://github.com/vector-im/hydrogen-web/#readme",
"devDependencies": {
"vite": "^2.6.2",
"typescript": "^4.3.5"
}
}

View file

@ -0,0 +1,22 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
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.
*/
export * from "./utils/index";
export * from "./observable/index";
export {IDBLogger} from "./logging/IDBLogger.js";
export {NullLogger} from "./logging/NullLogger.js";
export {ConsoleLogger} from "./logging/ConsoleLogger.js";
export type {LogItem} from "./logging/LogItem.js";

View file

@ -26,6 +26,7 @@ export { MappedList } from "./list/MappedList.js";
export { AsyncMappedList } from "./list/AsyncMappedList.js";
export { ConcatList } from "./list/ConcatList.js";
export { ObservableMap } from "./map/ObservableMap.js";
export { ObservableValue } from "./ObservableValue";
// avoid circular dependency between these classes
// and BaseObservableMap (as they extend it)

View file

@ -0,0 +1,31 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
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.
*/
export {AbortableOperation} from "./AbortableOperation";
export {Disposables} from "./Disposables.js";
export {createEnum} from "./enum.js";
export {AbortError} from "./error.js";
export {EventEmitter} from "./EventEmitter.js";
export {formatSize} from "./formatSize.js";
export {groupBy} from "./groupBy.js";
export {Lock} from "./Lock.js";
export {LockMap} from "./LockMap.js";
export {LRUCache} from "./LRUCache.js";
export {mergeMap} from "./mergeMap.js";
export {RetainedValue} from "./RetainedValue.js";
export {sortedIndex} from "./sortedIndex.js";
export {abortOnTimeout} from "./timeout.js";
export {typedJSON} from "./typedJSON.js";

View file

@ -14,13 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export function stringify(value: any): string {
return JSON.stringify(encodeValue(value));
}
export const typedJSON = {
stringify(value: any): string {
return JSON.stringify(encodeValue(value));
},
parse(value: string): any {
return decodeValue(JSON.parse(value));
}
};
export function parse(value: string): any {
return decodeValue(JSON.parse(value));
}
function encodeValue(value: any): any {
if (typeof value === "object" && value !== null && !Array.isArray(value)) {

View file

@ -0,0 +1,13 @@
export default {
build: {
lib: {
entry: "src/lib.ts",
formats: ["es", "iife"],
name: "hydrogenCommon",
}
},
public: false,
server: {
hmr: false
}
};

View file

@ -0,0 +1,14 @@
{
"name": "hydrogen-domain",
"version": "0.0.1",
"main": "src/lib.ts",
"homepage": "https://github.com/vector-im/hydrogen-web/#readme",
"devDependencies": {
"vite": "^2.6.2",
"typescript": "^4.3.5"
},
"dependencies": {
"hydrogen-common": "0.0.1",
"hydrogen-matrix": "0.0.1"
}
}

View file

@ -18,8 +18,7 @@ limitations under the License.
// as in some cases it would really be more convenient to have multiple events (like telling the timeline to scroll down)
// we do need to return a disposable from EventEmitter.on, or at least have a method here to easily track a subscription to an EventEmitter
import {EventEmitter} from "../utils/EventEmitter";
import {Disposables} from "../utils/Disposables.js";
import {Disposables, EventEmitter} from "hydrogen-common";
export class ViewModel extends EventEmitter {
constructor(options = {}) {

View file

@ -0,0 +1,22 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
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.
*/
export {createNavigation, createRouter} from "./navigation/index.js";
// export main view & view models
export {RootViewModel} from "./RootViewModel.js";
export {SessionViewModel} from "./session/SessionViewModel.js";
export {RoomViewModel} from "./session/room/RoomViewModel.js";
export {TimelineViewModel} from "./session/room/timeline/TimelineViewModel.js";

Some files were not shown because too many files have changed in this diff Show more