@jitar/plugin-vite 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -10
  2. package/dist/index.js +5 -5
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -6,28 +6,39 @@ This plugin allows you to use [Vite](https://vitejs.dev/) to build your [Jitar](
6
6
  ## Installation
7
7
 
8
8
  ```bash
9
- npm install --save-dev @jitar/vite-plugin
9
+ npm install --save-dev @jitar/plugin-vite
10
10
  ```
11
11
 
12
12
  ## Usage
13
13
 
14
14
  The plugin needs to be added to the vite config file.
15
15
 
16
- ```js
17
- // vite.config.js
16
+ ```ts
17
+ // vite.config.ts
18
18
  import { defineConfig } from 'vite'
19
- import jitar from '@jitar/plugin-vite'
19
+ import jitar, { JitarConfig } from '@jitar/plugin-vite'
20
+
21
+ const jitarConfig: JitarConfig = {
22
+ sourceDir: 'src',
23
+ targetDir: 'dist',
24
+ jitarDir: 'domain',
25
+ jitarUrl: 'http://localhost:3000',
26
+ segments: [],
27
+ middleware: []
28
+ }
20
29
 
21
30
  export default defineConfig({
22
31
  plugins: [
23
- jitar(srcPath, jitarPath, jitarUrl, [segments])
32
+ jitar(jitarConfig)
24
33
  ]
25
34
  })
26
35
  ```
27
36
 
28
- The plugin takes 4 arguments:
37
+ The plugin accepts a configuration object with the following properties:
29
38
 
30
- * **srcPath** - The path to the app source files. In most cases this is the `src` folder.
31
- * **jitarPath** - The path to the source files used by Jitar. This path is relative to the source root. We like to use `shared` (which points to `src/shared`), but feel free to use something else.
32
- * **jitarUrl** - The URL of the Jitar instance. Jitar uses by default `http://localhost:3000`, but can be configured differently in the Jitar config.
33
- * **segments** - The segments to use for the client app. This is an array of strings. The default is an empty array.
39
+ * **sourceDir** - The folder containing the app’s source files. In most cases, this is the `src` folder.
40
+ * **targetDir** - The folder where the app’s distribution files are output. In most cases, this is the `dist` folder.
41
+ * **jitarDir** - The folder containing the source files used by Jitar, relative to the source root. We typically use `domain` (which refers to `src/domain`), but feel free to use a different path.
42
+ * **jitarUrl** - The URL of the Jitar instance. By default, Jitar uses `http://localhost:3000`, but this can be changed in the Jitar configuration.
43
+ * **segments** - The segments to use for the client app. This should be an array of strings. The default value is an empty array.
44
+ * **middleware** - The middleware to use for the client app. This should be an array of strings. The default value is an empty array.
package/dist/index.js CHANGED
@@ -44,11 +44,11 @@ export default function viteJitar(pluginConfig) {
44
44
  };
45
45
  },
46
46
  configResolved(resolvedConfig) {
47
- rootPath = path.join(resolvedConfig.root);
48
- sourcePath = path.join(rootPath, sourceDir);
49
- targetPath = path.join(rootPath, targetDir);
50
- outputPath = path.join(targetPath, resolvedConfig.build.assetsDir);
51
- jitarPath = path.join(sourcePath, jitarDir);
47
+ rootPath = normalizePath(path.join(resolvedConfig.root));
48
+ sourcePath = normalizePath(path.join(rootPath, sourceDir));
49
+ targetPath = normalizePath(path.join(rootPath, targetDir));
50
+ outputPath = normalizePath(path.join(targetPath, resolvedConfig.build.assetsDir));
51
+ jitarPath = normalizePath(path.join(sourcePath, jitarDir));
52
52
  },
53
53
  options(options) {
54
54
  if (options.input === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitar/plugin-vite",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "Vite plugin for Jitar.",
5
5
  "author": "Masking Technology <info@masking.tech> (https://jitar.dev)",
6
6
  "license": "MIT",
@@ -27,10 +27,10 @@
27
27
  "access": "public"
28
28
  },
29
29
  "devDependencies": {
30
- "vite": "^6.3.4"
30
+ "vite": "^7.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "vite": ">=4.0.0 || >=5.0.0 || >=6.0.0"
33
+ "vite": ">=4.0.0 || >=5.0.0 || >=6.0.0 || >=7.0.0"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "vite": {