Skip to content

Commit

Permalink
Use submodules instead of exported namespaces in @wuespace/telestion (
Browse files Browse the repository at this point in the history
#416)

Previously, anything that wasn't exported on the root level of the `@wuespace/telestion` library had to be imported indirectly through namespaces:

```ts
import { utils } from '@wuespace/telestion';
const { wait } = utils;
```

This didn't provide a great developer experience, as imports couldn't be reoslved automatically.

Instead, these features now must be imported using submodules / path imports:

```ts
import { wait } from '@wuespace/telestion/utils';
```

As of the time of this change, a total of six of these modules exist:
- `@wuespace/telestion/application`, corresponding to `import { application } from '@wuespace/telestion'`
- `@wuespace/telestion/auth`, corresponding to `import { auth } from '@wuespace/telestion'`
- `@wuespace/telestion/nats`, corresponding to `import { nats } from '@wuespace/telestion'`
- `@wuespace/telestion/user-data`, corresponding to `import { userData } from '@wuespace/telestion'`
- `@wuespace/telestion/utils`, corresponding to `import { utils } from '@wuespace/telestion'`
- `@wuespace/telestion/widget`, corresponding to `import { widget } from '@wuespace/telestion'`

The previous namespaces were removed.
  • Loading branch information
pklaschka authored Jan 17, 2024
2 parents b246181 + 7827a43 commit d26f1e7
Show file tree
Hide file tree
Showing 33 changed files with 432 additions and 93 deletions.
8 changes: 7 additions & 1 deletion frontend-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ module.exports = {
'tsdoc/syntax': 'warn'
},
settings: {
react: { version: 'detect' }
react: { version: 'detect' },
// Support import aliases
'import/resolver': {
typescript: {
projects: ['./tsconfig.json', './tsconfig.node.json']
}
}
}
};
38 changes: 35 additions & 3 deletions frontend-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,42 @@
"dist",
"types"
],
"main": "./dist/telestion.umd.cjs",
"main": "./dist/index.cjs",
"exports": {
".": {
"import": "./dist/telestion.js",
"require": "./dist/telestion.umd.cjs"
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./types/src/lib/index.d.ts"
},
"./application": {
"import": "./dist/mod-application.js",
"require": "./dist/mod-application.cjs",
"types": "./types/src/lib/mod-application.d.ts"
},
"./auth": {
"import": "./dist/mod-auth.js",
"require": "./dist/mod-auth.cjs",
"types": "./types/src/lib/mod-auth.d.ts"
},
"./nats": {
"import": "./dist/mod-nats.js",
"require": "./dist/mod-nats.cjs",
"types": "./types/src/lib/mod-nats.d.ts"
},
"./user-data": {
"import": "./dist/mod-user-data.js",
"require": "./dist/mod-user-data.cjs",
"types": "./types/src/lib/mod-user-data.d.ts"
},
"./utils": {
"import": "./dist/mod-utils.js",
"require": "./dist/mod-utils.cjs",
"types": "./types/src/lib/mod-utils.d.ts"
},
"./widget": {
"import": "./dist/mod-widget.js",
"require": "./dist/mod-widget.cjs",
"types": "./types/src/lib/mod-widget.d.ts"
},
"./telestion.css": "./dist/style.css"
},
Expand Down Expand Up @@ -86,6 +117,7 @@
"@vitest/ui": "^1.0.4",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
Expand Down
197 changes: 197 additions & 0 deletions frontend-react/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend-react/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { initTelestion, registerWidgets, UserData } from '../lib';
import { initTelestion, registerWidgets, UserData } from '@wuespace/telestion';
import { simpleWidget } from './widgets/simple-widget';
import { errorWidget } from './widgets/error-widget';

Expand Down
Loading

0 comments on commit d26f1e7

Please sign in to comment.