Skip to content

Commit

Permalink
Fixed build and exports
Browse files Browse the repository at this point in the history
needed a few tweaks to make exporting work correctly with bundler resolution.

Signed-off-by: quobix <[email protected]>
  • Loading branch information
daveshanley committed Apr 5, 2024
1 parent 0699d2f commit 78d2dea
Show file tree
Hide file tree
Showing 8 changed files with 769 additions and 26 deletions.
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@
"private": false,
"description": "A tiny, pure JavaScript in-memory object store library for simple application state management",
"type": "module",
"main": "./dist/saddlebag.umd.cjs",
"module": "./dist/saddlebag.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/saddlebag.js",
"require": "./dist/saddlebag.umd.cjs"
}
},
"main": "./dist/saddlebag.js",
"types": "./dist/main.d.ts",
"scripts": {
"dev": "vite",
"build": "vite build && tsc",
"build": "vite build",
"preview": "vite preview",
"test": "vitest",
"coverage": "vitest run --coverage"
Expand All @@ -25,11 +18,12 @@
"@vitest/coverage-c8": "^0.31.1",
"@vitest/ui": "^0.31.1",
"c8": "^7.13.0",
"fake-indexeddb": "^5.0.2",
"i": "^0.3.7",
"typescript": "^5.0.2",
"vite": "^4.3.2",
"vite": "^5.2.8",
"vitest": "^0.31.1",
"fake-indexeddb": "^5.0.2"
"vite-plugin-dts": "^3.8.1"
},
"files": [
"dist"
Expand Down
6 changes: 3 additions & 3 deletions src/bag.manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {CreateBag} from "./saddlebag_engine.ts";
import {Bag} from "./saddlebag.ts";
import {CreateBag} from "./saddlebag_engine.js";
import {Bag} from "./saddlebag.js";


export const BAG_OBJECT_STORE = 'bags';
Expand Down Expand Up @@ -43,7 +43,7 @@ export interface BagManager {

}

interface BagDB {
export interface BagDB {
db: IDBDatabase | undefined;
}

Expand Down
3 changes: 0 additions & 3 deletions src/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './saddlebag_engine';
export * from './bag.manager';
export * from './saddlebag';
4 changes: 2 additions & 2 deletions src/saddlebag_engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
BagAllChangeSubscriptionFunction,
BagPopulatedSubscriptionFunction,
BagValueSubscriptionFunction, Subscription
} from "./saddlebag.ts";
import {BAG_OBJECT_STORE} from "./bag.manager.ts";
} from "./saddlebag.js";
import {BAG_OBJECT_STORE} from "./bag.manager.js";

export function CreateBag<T>(id: string, stateful?: boolean): Bag<T> {
return new bag<T>(id, stateful);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts"],
"include": ["src", "lib"],
"exclude": [
"**/*.spec.ts"
]
Expand Down
8 changes: 6 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
// vite.config.ts
import { resolve } from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

export default defineConfig({

build: {
minify: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
entry: resolve(__dirname, 'src/main.ts'),
name: 'saddlebag',
fileName: 'saddlebag',
formats: ['es'],

},
target: 'esnext',
},
plugins: [dts()]
});
751 changes: 748 additions & 3 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 78d2dea

Please sign in to comment.