@sleetch/vite 1.0.7 → 1.0.9

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/lib/plugin.js +22 -2
  2. package/package.json +22 -22
@@ -5,6 +5,13 @@ function plugin() {
5
5
  return {
6
6
  name: "sleetch",
7
7
  enforce: "pre",
8
+ config(config) {
9
+ return {
10
+ ssr: { noExternal: ["@sleetch/client"] },
11
+ optimizeDeps: { exclude: [...config.optimizeDeps?.exclude ?? [], "@sleetch/client"] },
12
+ server: { watch: { ignored: [...Array.isArray(config.server?.watch?.ignored) ? config.server.watch.ignored : config.server?.watch?.ignored ? [config.server.watch.ignored] : [], `!**/node_modules/@sleetch/client/**`] } }
13
+ };
14
+ },
8
15
  async buildStart() {
9
16
  if (this.environment.mode === "build" && !runtime.sources.loaded()) {
10
17
  console.log("buildStart", this.environment.name, this.environment.mode);
@@ -13,11 +20,24 @@ function plugin() {
13
20
  }
14
21
  },
15
22
  async configureServer(server) {
16
- if (server.config.mode == "development") {
17
- console.log("configServer", server.config.mode);
23
+ console.log("Hello dev");
24
+ server.watcher.add(`**/node_modules/@sleetch/client/**`);
25
+ const invalidateAll = (file) => {
26
+ console.log("invalidate", file);
27
+ for (const env of Object.values(server.environments)) {
28
+ const mods = env.moduleGraph.getModulesByFile(file);
29
+ if (mods) for (const mod of mods) env.moduleGraph.invalidateModule(mod);
30
+ }
31
+ };
32
+ if (server.config.mode === "development") {
18
33
  await runtime.sources.load();
19
34
  await runtime.builder.build();
20
35
  await runtime.sources.watch();
36
+ runtime.watcher.on("edited-page", (content, source) => {
37
+ const object = source.router.get_object(content);
38
+ const build_path = source.builder.get_path(source.language, object);
39
+ invalidateAll(build_path);
40
+ });
21
41
  }
22
42
  }
23
43
  };
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
- "name": "@sleetch/vite",
3
- "version": "1.0.7",
4
- "type": "module",
5
- "files": [
6
- "dist"
7
- ],
8
- "publishConfig": {
9
- "access": "public"
10
- },
11
- "scripts": {
12
- "build": "tsdown",
13
- "dev": "tsdown --watch"
14
- },
15
- "exports": {
16
- ".": "./dist/index.js",
17
- "./lib/plugin": "./dist/lib/plugin.js",
18
- "./package.json": "./package.json"
19
- },
20
- "dependencies": {
21
- "@sleetch/core": "1.0.7",
22
- "vite": "^8.1.0"
23
- }
2
+ "name": "@sleetch/vite",
3
+ "version": "1.0.9",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "build": "tsdown",
13
+ "dev": "tsdown --watch"
14
+ },
15
+ "exports": {
16
+ ".": "./dist/index.js",
17
+ "./lib/plugin": "./dist/lib/plugin.js",
18
+ "./package.json": "./package.json"
19
+ },
20
+ "dependencies": {
21
+ "@sleetch/core": "1.0.9",
22
+ "vite": "^8.1.0"
23
+ }
24
24
  }