@jay-framework/rollup-plugin 0.6.0 → 0.6.2

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.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { LoadResult, TransformResult, CustomPluginOptions, ResolveIdResult } fro
4
4
  import * as ts from 'typescript';
5
5
  import { CompilerOptions } from 'typescript';
6
6
  import { GenerateTarget, CompilerSourceFile } from '@jay-framework/compiler-shared';
7
+ import { ViteDevServer } from 'vite';
7
8
 
8
9
  declare function jayDefinitions(): {
9
10
  name: string;
@@ -43,6 +44,7 @@ declare class JayPluginContext {
43
44
 
44
45
  declare function jayRuntime(jayOptions?: JayRollupConfig, givenJayContext?: JayPluginContext): {
45
46
  name: string;
47
+ configureServer(_server: ViteDevServer): void;
46
48
  resolveId(source: string, importer: string | undefined, options: ResolveIdOptions): Promise<ResolveIdResult>;
47
49
  load(id: string): Promise<LoadResult>;
48
50
  transform(code: string, id: string): Promise<TransformResult>;
package/dist/index.js CHANGED
@@ -416,9 +416,12 @@ class JayPluginContext {
416
416
  const GLOBAL_FUNC_REPOSITORY = "GLOBAL_FUNC_REPOSITORY.ts";
417
417
  function jayRuntime(jayOptions = {}, givenJayContext) {
418
418
  const jayContext = givenJayContext || new JayPluginContext(jayOptions);
419
+ let server;
419
420
  return {
420
421
  name: "jay:runtime",
421
- // this name will show up in warnings and errors
422
+ configureServer(_server) {
423
+ server = _server;
424
+ },
422
425
  async resolveId(source, importer, options) {
423
426
  if (compilerShared.hasExtension(source, compilerShared.JAY_EXTENSION))
424
427
  return await resolveJayHtml(
@@ -472,6 +475,15 @@ function jayRuntime(jayOptions = {}, givenJayContext) {
472
475
  watchChange(id, change) {
473
476
  console.log(`[watchChange] ${id} ${change.event}`);
474
477
  jayContext.deleteCachedJayFile(id);
478
+ if (server) {
479
+ const module2 = server.moduleGraph.getModuleById(id + compilerShared.TS_EXTENSION);
480
+ if (module2) {
481
+ server.moduleGraph.invalidateModule(module2);
482
+ server.ws.send({
483
+ type: "full-reload"
484
+ });
485
+ }
486
+ }
475
487
  }
476
488
  };
477
489
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/rollup-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [
@@ -26,16 +26,16 @@
26
26
  "test:watch": "vitest"
27
27
  },
28
28
  "dependencies": {
29
- "@jay-framework/compiler": "^0.6.0",
30
- "@jay-framework/compiler-jay-html": "^0.6.0",
29
+ "@jay-framework/compiler": "^0.6.2",
30
+ "@jay-framework/compiler-jay-html": "^0.6.2",
31
31
  "fast-glob": "^3.3.2",
32
32
  "typescript": "^5.3.3"
33
33
  },
34
34
  "devDependencies": {
35
- "@jay-framework/component": "^0.6.0",
36
- "@jay-framework/dev-environment": "^0.6.0",
37
- "@jay-framework/runtime": "^0.6.0",
38
- "@jay-framework/secure": "^0.6.0",
35
+ "@jay-framework/component": "^0.6.2",
36
+ "@jay-framework/dev-environment": "^0.6.2",
37
+ "@jay-framework/runtime": "^0.6.2",
38
+ "@jay-framework/secure": "^0.6.2",
39
39
  "@types/node": "^20.11.5",
40
40
  "rimraf": "^5.0.5",
41
41
  "rollup": "^4.9.5",