@navita/vite-plugin 0.0.8 → 0.0.10

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/index.js +25 -5
  2. package/index.mjs +25 -5
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -33,9 +33,28 @@ function navita(options) {
33
33
  ];
34
34
  let server;
35
35
  let lastCssContent;
36
+ let context;
36
37
  return {
37
38
  name: "navita",
38
39
  enforce: "pre",
40
+ config (_, env) {
41
+ return {
42
+ optimizeDeps: {
43
+ include: env.command === 'serve' ? [
44
+ '@navita/css'
45
+ ] : []
46
+ },
47
+ ssr: {
48
+ external: [
49
+ '@navita/css',
50
+ '@navita/adapter'
51
+ ]
52
+ }
53
+ };
54
+ },
55
+ configResolved (config) {
56
+ context = config.root;
57
+ },
39
58
  configureServer (_server) {
40
59
  lastCssContent = undefined;
41
60
  server = _server;
@@ -47,6 +66,7 @@ function navita(options) {
47
66
  ...options?.engineOptions || {}
48
67
  };
49
68
  renderer = createRenderer.createRenderer({
69
+ context,
50
70
  importMap,
51
71
  engineOptions: defaultEngineOptions,
52
72
  resolver: async (filepath, request)=>{
@@ -75,7 +95,7 @@ function navita(options) {
75
95
  if (!importMap.map((x)=>x.source).some((value)=>code.indexOf(value) !== -1)) {
76
96
  return null;
77
97
  }
78
- const { result } = await renderer.transformAndProcess({
98
+ const { result , sourceMap } = await renderer.transformAndProcess({
79
99
  content: code,
80
100
  filePath: id
81
101
  });
@@ -91,10 +111,10 @@ function navita(options) {
91
111
  }
92
112
  lastCssContent = newCssContent;
93
113
  }
94
- return `
95
- ${result}
96
- import "${VIRTUAL_MODULE_NAME}";
97
- `;
114
+ return {
115
+ code: `${result} import "${VIRTUAL_MODULE_NAME}";`,
116
+ map: sourceMap
117
+ };
98
118
  },
99
119
  renderChunk (_, chunk) {
100
120
  for (const id of Object.keys(chunk.modules)){
package/index.mjs CHANGED
@@ -12,9 +12,28 @@ function navita(options) {
12
12
  ];
13
13
  let server;
14
14
  let lastCssContent;
15
+ let context;
15
16
  return {
16
17
  name: "navita",
17
18
  enforce: "pre",
19
+ config (_, env) {
20
+ return {
21
+ optimizeDeps: {
22
+ include: env.command === 'serve' ? [
23
+ '@navita/css'
24
+ ] : []
25
+ },
26
+ ssr: {
27
+ external: [
28
+ '@navita/css',
29
+ '@navita/adapter'
30
+ ]
31
+ }
32
+ };
33
+ },
34
+ configResolved (config) {
35
+ context = config.root;
36
+ },
18
37
  configureServer (_server) {
19
38
  lastCssContent = undefined;
20
39
  server = _server;
@@ -26,6 +45,7 @@ function navita(options) {
26
45
  ...options?.engineOptions || {}
27
46
  };
28
47
  renderer = createRenderer({
48
+ context,
29
49
  importMap: importMap$1,
30
50
  engineOptions: defaultEngineOptions,
31
51
  resolver: async (filepath, request)=>{
@@ -54,7 +74,7 @@ function navita(options) {
54
74
  if (!importMap$1.map((x)=>x.source).some((value)=>code.indexOf(value) !== -1)) {
55
75
  return null;
56
76
  }
57
- const { result } = await renderer.transformAndProcess({
77
+ const { result , sourceMap } = await renderer.transformAndProcess({
58
78
  content: code,
59
79
  filePath: id
60
80
  });
@@ -70,10 +90,10 @@ function navita(options) {
70
90
  }
71
91
  lastCssContent = newCssContent;
72
92
  }
73
- return `
74
- ${result}
75
- import "${VIRTUAL_MODULE_NAME}";
76
- `;
93
+ return {
94
+ code: `${result} import "${VIRTUAL_MODULE_NAME}";`,
95
+ map: sourceMap
96
+ };
77
97
  },
78
98
  renderChunk (_, chunk) {
79
99
  for (const id of Object.keys(chunk.modules)){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navita/vite-plugin",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Navita Vite Plugin",
5
5
  "keywords": [
6
6
  "vite",
@@ -17,8 +17,8 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@navita/core": "0.0.8",
21
- "@navita/css": "0.0.8"
20
+ "@navita/core": "0.0.10",
21
+ "@navita/css": "0.0.10"
22
22
  },
23
23
  "license": "MIT",
24
24
  "author": "Eagerpatch",