@jitar/plugin-vite 0.4.1 → 0.5.0

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 (2) hide show
  1. package/dist/index.js +3 -4
  2. package/package.json +14 -7
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ function createServerConfig(jitarUrl) {
28
28
  }
29
29
  function createBootstrapCode(segments) {
30
30
  const segmentString = segments.map(segment => `'${segment}'`).join(', ');
31
- return `<script type="module">const jitar = await import('/jitar/client.js'); await jitar.startClient(document.location.origin, [${segmentString}]);</script>`;
31
+ return `<script type="module">const jitar = await import("/jitar/client.js"); await jitar.startClient(document.location.origin, [${segmentString}]);</script>`;
32
32
  }
33
33
  async function createImportCode(code, id, jitarFullPath, jitarPath) {
34
34
  const relativeId = id
@@ -48,9 +48,8 @@ async function createImportCode(code, id, jitarFullPath, jitarPath) {
48
48
  importCode += functionKeys.map(key => `const ${key} = module.${key};`).join('\n');
49
49
  exportCode += `export { ${functionKeys.join(', ')} };\n`;
50
50
  }
51
- return 'const jitar = await import(/* @vite-ignore */`/jitar/client.js`);\n'
52
- + 'const client = await jitar.getClient();\n'
53
- + `const module = await client.import('./${jitarPath}${relativeId}');\n`
51
+ return 'import { getClient } from "/jitar/client.js";\n'
52
+ + `const module = await (await getClient()).import("./${jitarPath}${relativeId}");\n`
54
53
  + importCode
55
54
  + exportCode;
56
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitar/plugin-vite",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Vite plugin for Jitar.",
5
5
  "author": "Masking Technology <info@masking.tech> (https://jitar.dev)",
6
6
  "license": "MIT",
@@ -12,22 +12,29 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
- "files": ["CHANGELOG.md", "README.md", "dist"],
15
+ "files": [
16
+ "CHANGELOG.md",
17
+ "README.md",
18
+ "dist"
19
+ ],
16
20
  "scripts": {
17
21
  "build": "tsc -p tsconfig.json",
18
22
  "lint": "eslint . --ext .ts",
19
23
  "clean": "rm -rf dist build",
20
- "release": "npm run clean && npm run build && npm publish --access public"
24
+ "prepublishOnly": "npm run clean && npm run build"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
21
28
  },
22
29
  "dependencies": {
23
- "@jitar/reflection": "^0.4.1"
30
+ "@jitar/reflection": "^0.5.0"
24
31
  },
25
32
  "peerDependencies": {
26
- "vite": "^4.3.5"
33
+ "vite": "^4.4.11"
27
34
  },
28
35
  "repository": {
29
36
  "type": "git",
30
- "url": "https://github.com/MaskingTechnology/jitar"
37
+ "url": "git+https://github.com/MaskingTechnology/jitar.git"
31
38
  },
32
39
  "bugs": {
33
40
  "url": "https://github.com/MaskingTechnology/jitar/issues"
@@ -37,4 +44,4 @@
37
44
  "vite",
38
45
  "jitar"
39
46
  ]
40
- }
47
+ }