@jitar/plugin-vite 0.8.1 → 0.9.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 +6 -5
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -20,9 +20,6 @@ function assureExtension(filename) {
20
20
  }
21
21
  return `${filename}.js`;
22
22
  }
23
- function makeShared(filename) {
24
- return assureExtension(filename).replace('.js', '.shared.js');
25
- }
26
23
  export default function viteJitar(pluginConfig) {
27
24
  const sourceDir = formatDir(pluginConfig.sourceDir);
28
25
  const targetDir = formatDir(pluginConfig.targetDir);
@@ -30,7 +27,7 @@ export default function viteJitar(pluginConfig) {
30
27
  const jitarUrl = pluginConfig.jitarUrl;
31
28
  const segments = pluginConfig.segments ?? [];
32
29
  const middlewares = pluginConfig.middleware ?? [];
33
- const scopes = ['shared', ...segments, 'remote'];
30
+ const scopes = [...segments, 'remote'];
34
31
  let rootPath;
35
32
  let sourcePath;
36
33
  let targetPath;
@@ -91,6 +88,10 @@ export default function viteJitar(pluginConfig) {
91
88
  return scopeId;
92
89
  }
93
90
  }
91
+ const scopeId = cacheId.replace('.ts', '.js');
92
+ if (fs.existsSync(scopeId)) {
93
+ return scopeId;
94
+ }
94
95
  return resolution.id;
95
96
  }
96
97
  },
@@ -99,7 +100,7 @@ export default function viteJitar(pluginConfig) {
99
100
  return null;
100
101
  }
101
102
  const segmentFiles = segments.map(name => `${targetPath}/${name}.segment.js`);
102
- const middlewareFiles = middlewares.map(name => makeShared(`${targetPath}/${name}`));
103
+ const middlewareFiles = middlewares.map(name => assureExtension(`${targetPath}/${name}`));
103
104
  const jitarImport = `import { ClientBuilder, HttpRemoteBuilder } from "${JITAR_CLIENT_ID}";`;
104
105
  const segmentImports = segmentFiles.map((filename, index) => `import { default as $S${index} } from "${filename}";`).join('');
105
106
  const middlewareImports = middlewareFiles.map((filename, index) => `import { default as $M${index} } from "${filename}";`).join('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitar/plugin-vite",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Vite plugin for Jitar.",
5
5
  "author": "Masking Technology <info@masking.tech> (https://jitar.dev)",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "build": "tsc -p tsconfig.json",
22
- "lint": "eslint . --ext .ts",
22
+ "lint": "eslint",
23
23
  "clean": "rm -rf dist build",
24
24
  "prepublishOnly": "npm run clean && npm run build"
25
25
  },
@@ -27,7 +27,7 @@
27
27
  "access": "public"
28
28
  },
29
29
  "peerDependencies": {
30
- "vite": ">=4.0.0 || >=5.0.0"
30
+ "vite": ">=4.0.0 || >=5.0.0 || >=6.0.0"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  "vite": {
@@ -47,5 +47,5 @@
47
47
  "vite-plugin",
48
48
  "jitar"
49
49
  ],
50
- "gitHead": "cb82f7e31ef4015e0d569a70f1e990859dc0f870"
50
+ "gitHead": "ab343592336927a9f9d1478da22d8e36ebf89382"
51
51
  }