diff --git a/.gitignore b/.gitignore
index a2a9cfdb..68d817a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,3 +73,5 @@ docs/public
test-results.xml
.vercel
+
+.reports
diff --git a/app/vite.config.ts b/app/vite.config.ts
index fea1d04f..cf380e33 100644
--- a/app/vite.config.ts
+++ b/app/vite.config.ts
@@ -4,7 +4,6 @@ import {
defineConfig,
} from 'vite';
-// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 6565,
@@ -13,8 +12,7 @@ export default defineConfig({
stringify: true,
},
build: {
- sourcemap: true,
- cssCodeSplit: true,
+ sourcemap: 'hidden',
commonjsOptions: {
esmExternals: true,
},
diff --git a/app/vue-shim.d.ts b/app/vue-shim.d.ts
index 18c6d0f8..fcb96d57 100644
--- a/app/vue-shim.d.ts
+++ b/app/vue-shim.d.ts
@@ -1,9 +1,9 @@
declare module '*.vue' {
import type {
- DefineComponent
+ DefineComponent,
} from 'vue';
const component: DefineComponent<{}, {}, any>;
-
- export default component
+
+ export default component;
}
\ No newline at end of file
diff --git a/examples/nuxt/app.vue b/examples/nuxt/app.vue
deleted file mode 100644
index 8ace1792..00000000
--- a/examples/nuxt/app.vue
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
{{ state }}
-
-
-
- Reset
-
-
-
-
-
-
-
diff --git a/examples/nuxt/nuxt.config.ts b/examples/nuxt/nuxt.config.ts
index 1ea8d87a..acd6757b 100644
--- a/examples/nuxt/nuxt.config.ts
+++ b/examples/nuxt/nuxt.config.ts
@@ -4,6 +4,7 @@ import {
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
+ srcDir: 'src/',
modules: [
'@nuxtjs/harlem',
],
diff --git a/examples/nuxt/package.json b/examples/nuxt/package.json
index 041783f0..0dc01fae 100644
--- a/examples/nuxt/package.json
+++ b/examples/nuxt/package.json
@@ -1,17 +1,18 @@
{
+ "name": "@harlem/example-nuxt",
"private": true,
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"start": "node .output/server/index.mjs"
},
- "devDependencies": {
- "nuxt3": "latest"
- },
"dependencies": {
- "@harlem/extension-compose": "^2.2.3",
- "@harlem/extension-reset": "^2.2.3",
- "@harlem/extension-storage": "^2.2.3",
+ "@harlem/extension-compose": "^2.3.0",
+ "@harlem/extension-reset": "^2.3.0",
+ "@harlem/extension-storage": "^2.3.0",
"@nuxtjs/harlem": "^1.0.1"
+ },
+ "devDependencies": {
+ "nuxt3": "latest"
}
}
diff --git a/examples/nuxt/src/app.vue b/examples/nuxt/src/app.vue
new file mode 100644
index 00000000..f355265b
--- /dev/null
+++ b/examples/nuxt/src/app.vue
@@ -0,0 +1,21 @@
+
+
+
Welcome {{ fullName }}
+
+
+
+ Reset
+
+
+
+
+
diff --git a/examples/nuxt/store.ts b/examples/nuxt/src/store.ts
similarity index 82%
rename from examples/nuxt/store.ts
rename to examples/nuxt/src/store.ts
index c1a3db5c..dfe147dc 100644
--- a/examples/nuxt/store.ts
+++ b/examples/nuxt/src/store.ts
@@ -19,4 +19,6 @@ export const {
}),
resetExtension(), // order is important!
],
-});
\ No newline at end of file
+});
+
+export const fullName = getter('fullname', ({ firstName, lastName }) => `${firstName} ${lastName}`);
\ No newline at end of file
diff --git a/examples/vite-ts/README.md b/examples/vite-ts/README.md
new file mode 100644
index 00000000..32d27ba9
--- /dev/null
+++ b/examples/vite-ts/README.md
@@ -0,0 +1,29 @@
+# Nuxt 3 Minimal Starter
+
+We recommend to look at the [documentation](https://v3.nuxtjs.org).
+
+## Setup
+
+Make sure to install the dependencies
+
+```bash
+yarn install
+```
+
+## Development
+
+Start the development server on http://localhost:3000
+
+```bash
+yarn dev
+```
+
+## Production
+
+Build the application for production:
+
+```bash
+yarn build
+```
+
+Checkout the [deployment documentation](https://v3.nuxtjs.org/docs/deployment).
\ No newline at end of file
diff --git a/examples/vite-ts/index.html b/examples/vite-ts/index.html
new file mode 100644
index 00000000..75bccf49
--- /dev/null
+++ b/examples/vite-ts/index.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ Harlem Example Vite + TS Application
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/vite-ts/package.json b/examples/vite-ts/package.json
new file mode 100644
index 00000000..cadbf070
--- /dev/null
+++ b/examples/vite-ts/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "@harlem/example-vite-ts",
+ "private": true,
+ "scripts": {
+ "start": "vite",
+ "build": "vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@harlem/core": "^2.3.0",
+ "@harlem/extension-compose": "^2.3.0",
+ "@harlem/extension-reset": "^2.3.0",
+ "@harlem/extension-storage": "^2.3.0",
+ "@harlem/plugin-devtools": "^2.3.0",
+ "vue": "^3.2.31"
+ },
+ "devDependencies": {
+ "@vitejs/plugin-vue": "^2.2.4",
+ "vite": "^2.8.5"
+ }
+}
diff --git a/examples/vite-ts/public/favicon.png b/examples/vite-ts/public/favicon.png
new file mode 100644
index 00000000..add028a4
Binary files /dev/null and b/examples/vite-ts/public/favicon.png differ
diff --git a/examples/vite-ts/src/app.vue b/examples/vite-ts/src/app.vue
new file mode 100644
index 00000000..f355265b
--- /dev/null
+++ b/examples/vite-ts/src/app.vue
@@ -0,0 +1,21 @@
+
+
+
Welcome {{ fullName }}
+
+
+
+ Reset
+
+
+
+
+
diff --git a/examples/vite-ts/src/index.ts b/examples/vite-ts/src/index.ts
new file mode 100644
index 00000000..f1e93f4e
--- /dev/null
+++ b/examples/vite-ts/src/index.ts
@@ -0,0 +1,20 @@
+import App from './app.vue';
+import Harlem from '@harlem/core';
+
+import harlemDevtoolsPlugin from '@harlem/plugin-devtools';
+
+import {
+ createApp,
+} from 'vue';
+
+function main() {
+ return createApp(App)
+ .use(Harlem, {
+ plugins: [
+ harlemDevtoolsPlugin(),
+ ],
+ })
+ .mount('#app');
+}
+
+main();
\ No newline at end of file
diff --git a/examples/vite-ts/src/store.ts b/examples/vite-ts/src/store.ts
new file mode 100644
index 00000000..b9c4df33
--- /dev/null
+++ b/examples/vite-ts/src/store.ts
@@ -0,0 +1,28 @@
+import composeExtension from '@harlem/extension-compose';
+import storageExtension from '@harlem/extension-storage';
+import resetExtension from '@harlem/extension-reset';
+
+import {
+ createStore,
+} from '@harlem/core';
+
+export const {
+ state,
+ getter,
+ reset,
+ computeState,
+} = createStore('app', {
+ firstName: 'John',
+ lastName: 'Smith',
+}, {
+ extensions: [
+ composeExtension(),
+ storageExtension({
+ prefix: 'vite-ts',
+ restore: true,
+ }),
+ resetExtension(), // order is important!
+ ],
+});
+
+export const fullName = getter('fullname', ({ firstName, lastName }) => `${firstName} ${lastName}`);
\ No newline at end of file
diff --git a/examples/vite-ts/tsconfig.json b/examples/vite-ts/tsconfig.json
new file mode 100644
index 00000000..e2585dc0
--- /dev/null
+++ b/examples/vite-ts/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "resolveJsonModule": true,
+ "types": [
+ "vite/client"
+ ]
+ },
+ "include": [
+ "src/**/*.ts",
+ "src/**/*.d.ts",
+ "src/**/*.vue",
+ "vue-shim.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/examples/vite-ts/vite.config.ts b/examples/vite-ts/vite.config.ts
new file mode 100644
index 00000000..121a4605
--- /dev/null
+++ b/examples/vite-ts/vite.config.ts
@@ -0,0 +1,22 @@
+import vuePlugin from '@vitejs/plugin-vue';
+
+import {
+ defineConfig,
+} from 'vite';
+
+export default defineConfig({
+ json: {
+ stringify: true,
+ },
+ build: {
+ commonjsOptions: {
+ esmExternals: true,
+ },
+ },
+ define: {
+ '__VUE_OPTIONS_API__': false,
+ },
+ plugins: [
+ vuePlugin(),
+ ],
+});
\ No newline at end of file
diff --git a/examples/vite-ts/vue-shim.d.ts b/examples/vite-ts/vue-shim.d.ts
new file mode 100644
index 00000000..fcb96d57
--- /dev/null
+++ b/examples/vite-ts/vue-shim.d.ts
@@ -0,0 +1,9 @@
+declare module '*.vue' {
+ import type {
+ DefineComponent,
+ } from 'vue';
+
+ const component: DefineComponent<{}, {}, any>;
+
+ export default component;
+}
\ No newline at end of file
diff --git a/vitest.config.ts b/vitest.config.ts
index 96eccc98..a59cc9fe 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -4,8 +4,8 @@ import {
export default defineConfig({
test: {
- environment: 'jsdom',
watch: false,
+ environment: 'jsdom',
outputFile: 'test-results.xml',
reporters: [
'verbose',
@@ -13,6 +13,7 @@ export default defineConfig({
],
coverage: {
enabled: true,
+ reportsDirectory: './.reports/coverage',
reporter: [
'text-summary',
],
diff --git a/yarn.lock b/yarn.lock
index 79fea3aa..67692d8d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -878,7 +878,50 @@ __metadata:
languageName: unknown
linkType: soft
-"@harlem/extension-action@^2.3.0, @harlem/extension-action@workspace:extensions/action":
+"@harlem/example-nuxt@workspace:examples/nuxt":
+ version: 0.0.0-use.local
+ resolution: "@harlem/example-nuxt@workspace:examples/nuxt"
+ dependencies:
+ "@harlem/extension-compose": ^2.3.0
+ "@harlem/extension-reset": ^2.3.0
+ "@harlem/extension-storage": ^2.3.0
+ "@nuxtjs/harlem": ^1.0.1
+ nuxt3: latest
+ languageName: unknown
+ linkType: soft
+
+"@harlem/example-vite-ts-actions@workspace:examples/vite-ts-actions":
+ version: 0.0.0-use.local
+ resolution: "@harlem/example-vite-ts-actions@workspace:examples/vite-ts-actions"
+ dependencies:
+ "@harlem/core": ^2.3.0
+ "@harlem/extension-action": "workspace:^"
+ "@harlem/extension-compose": ^2.3.0
+ "@harlem/extension-reset": ^2.3.0
+ "@harlem/extension-storage": ^2.3.0
+ "@harlem/plugin-devtools": ^2.3.0
+ "@vitejs/plugin-vue": ^2.2.4
+ vite: ^2.8.5
+ vue: ^3.2.31
+ languageName: unknown
+ linkType: soft
+
+"@harlem/example-vite-ts@workspace:examples/vite-ts":
+ version: 0.0.0-use.local
+ resolution: "@harlem/example-vite-ts@workspace:examples/vite-ts"
+ dependencies:
+ "@harlem/core": ^2.3.0
+ "@harlem/extension-compose": ^2.3.0
+ "@harlem/extension-reset": ^2.3.0
+ "@harlem/extension-storage": ^2.3.0
+ "@harlem/plugin-devtools": ^2.3.0
+ "@vitejs/plugin-vue": ^2.2.4
+ vite: ^2.8.5
+ vue: ^3.2.31
+ languageName: unknown
+ linkType: soft
+
+"@harlem/extension-action@^2.3.0, @harlem/extension-action@workspace:^, @harlem/extension-action@workspace:extensions/action":
version: 0.0.0-use.local
resolution: "@harlem/extension-action@workspace:extensions/action"
dependencies:
@@ -892,7 +935,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@harlem/extension-compose@^2.2.3, @harlem/extension-compose@^2.3.0, @harlem/extension-compose@workspace:extensions/compose":
+"@harlem/extension-compose@^2.3.0, @harlem/extension-compose@workspace:extensions/compose":
version: 0.0.0-use.local
resolution: "@harlem/extension-compose@workspace:extensions/compose"
dependencies:
@@ -931,7 +974,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@harlem/extension-reset@^2.2.3, @harlem/extension-reset@^2.3.0, @harlem/extension-reset@workspace:extensions/reset":
+"@harlem/extension-reset@^2.3.0, @harlem/extension-reset@workspace:extensions/reset":
version: 0.0.0-use.local
resolution: "@harlem/extension-reset@workspace:extensions/reset"
dependencies:
@@ -955,7 +998,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@harlem/extension-storage@^2.2.3, @harlem/extension-storage@^2.3.0, @harlem/extension-storage@workspace:extensions/storage":
+"@harlem/extension-storage@^2.3.0, @harlem/extension-storage@workspace:extensions/storage":
version: 0.0.0-use.local
resolution: "@harlem/extension-storage@workspace:extensions/storage"
dependencies:
@@ -2921,6 +2964,16 @@ __metadata:
languageName: node
linkType: hard
+"@vitejs/plugin-vue@npm:^2.2.4":
+ version: 2.2.4
+ resolution: "@vitejs/plugin-vue@npm:2.2.4"
+ peerDependencies:
+ vite: ^2.5.10
+ vue: ^3.2.25
+ checksum: 915f494940dd62d20204671a0d3bd81bcd44c02b314847325c9d0ad2f634eb3c012d3a00ffcac60416a5239e1d5e47e9cbf38f9c8cc9de708e12b98876ce946b
+ languageName: node
+ linkType: hard
+
"@vue/babel-helper-vue-transform-on@npm:^1.0.2":
version: 1.0.2
resolution: "@vue/babel-helper-vue-transform-on@npm:1.0.2"
@@ -9858,18 +9911,6 @@ __metadata:
languageName: node
linkType: hard
-"nuxt-6d426f@workspace:examples/nuxt":
- version: 0.0.0-use.local
- resolution: "nuxt-6d426f@workspace:examples/nuxt"
- dependencies:
- "@harlem/extension-compose": ^2.2.3
- "@harlem/extension-reset": ^2.2.3
- "@harlem/extension-storage": ^2.2.3
- "@nuxtjs/harlem": ^1.0.1
- nuxt3: latest
- languageName: unknown
- linkType: soft
-
"nuxt3@npm:latest":
version: 3.0.0-27430570.4cfad4d
resolution: "nuxt3@npm:3.0.0-27430570.4cfad4d"
@@ -13330,6 +13371,35 @@ __metadata:
languageName: node
linkType: hard
+"vite@npm:^2.8.5":
+ version: 2.8.5
+ resolution: "vite@npm:2.8.5"
+ dependencies:
+ esbuild: ^0.14.14
+ fsevents: ~2.3.2
+ postcss: ^8.4.6
+ resolve: ^1.22.0
+ rollup: ^2.59.0
+ peerDependencies:
+ less: "*"
+ sass: "*"
+ stylus: "*"
+ dependenciesMeta:
+ fsevents:
+ optional: true
+ peerDependenciesMeta:
+ less:
+ optional: true
+ sass:
+ optional: true
+ stylus:
+ optional: true
+ bin:
+ vite: bin/vite.js
+ checksum: 07688f8183fee2595e389d966011e94b2a069a3b6f3ff06b8edf452daaea76e2432c26e0eb60156543b3e42fb93e739a5d74667cc4bfc2c86b7c58ac7912a333
+ languageName: node
+ linkType: hard
+
"vitest@npm:^0.5.7":
version: 0.5.7
resolution: "vitest@npm:0.5.7"