@navita/vite-plugin 2.0.2 → 2.0.4
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/package.json +3 -3
- package/remix.cjs +8 -5
- package/remix.mjs +8 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navita/vite-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Navita Vite Plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@navita/
|
|
26
|
-
"@navita/
|
|
25
|
+
"@navita/core": "1.0.1",
|
|
26
|
+
"@navita/css": "0.2.0"
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"author": "Eagerpatch",
|
package/remix.cjs
CHANGED
|
@@ -22,7 +22,10 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
|
|
23
23
|
var crypto__namespace = /*#__PURE__*/_interopNamespaceDefault(crypto);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const VIRTUAL_MODULE_IDS = [
|
|
26
|
+
'\0virtual:remix/server-build',
|
|
27
|
+
'\0virtual:react-router/server-build'
|
|
28
|
+
];
|
|
26
29
|
let cssFileName;
|
|
27
30
|
function navitaRemix(options) {
|
|
28
31
|
let isProduction = false;
|
|
@@ -36,10 +39,10 @@ function navitaRemix(options) {
|
|
|
36
39
|
isProduction = config.mode === 'production';
|
|
37
40
|
},
|
|
38
41
|
transform (code, id) {
|
|
39
|
-
if (isProduction || id
|
|
42
|
+
if (isProduction || !VIRTUAL_MODULE_IDS.includes(id)) {
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
|
-
return `${code}\n${
|
|
45
|
+
return `${code}\n${SERVER_BUILD_EXTENSION}`;
|
|
43
46
|
},
|
|
44
47
|
renderChunk (_, chunk, options) {
|
|
45
48
|
const isServerChunk = options.dir.endsWith('/server');
|
|
@@ -56,7 +59,7 @@ function navitaRemix(options) {
|
|
|
56
59
|
}
|
|
57
60
|
if (isServerChunk && !hasEmittedCss) {
|
|
58
61
|
// In the server-build, we'll generate the CSS and emit it as an asset.
|
|
59
|
-
// Remix will then move it to the client assets.
|
|
62
|
+
// Remix/react-router will then move it to the client assets.
|
|
60
63
|
this.emitFile({
|
|
61
64
|
fileName: cssFileName,
|
|
62
65
|
name: 'navita.css',
|
|
@@ -69,7 +72,7 @@ function navitaRemix(options) {
|
|
|
69
72
|
}
|
|
70
73
|
];
|
|
71
74
|
}
|
|
72
|
-
const
|
|
75
|
+
const SERVER_BUILD_EXTENSION = `
|
|
73
76
|
routes.root.module = {
|
|
74
77
|
...route0,
|
|
75
78
|
links: () => [
|
package/remix.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as crypto from 'node:crypto';
|
|
2
2
|
import { navita, getRenderer, VIRTUAL_MODULE_ID } from './index.mjs';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const VIRTUAL_MODULE_IDS = [
|
|
5
|
+
'\0virtual:remix/server-build',
|
|
6
|
+
'\0virtual:react-router/server-build'
|
|
7
|
+
];
|
|
5
8
|
let cssFileName;
|
|
6
9
|
function navitaRemix(options) {
|
|
7
10
|
let isProduction = false;
|
|
@@ -15,10 +18,10 @@ function navitaRemix(options) {
|
|
|
15
18
|
isProduction = config.mode === 'production';
|
|
16
19
|
},
|
|
17
20
|
transform (code, id) {
|
|
18
|
-
if (isProduction || id
|
|
21
|
+
if (isProduction || !VIRTUAL_MODULE_IDS.includes(id)) {
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
|
-
return `${code}\n${
|
|
24
|
+
return `${code}\n${SERVER_BUILD_EXTENSION}`;
|
|
22
25
|
},
|
|
23
26
|
renderChunk (_, chunk, options) {
|
|
24
27
|
const isServerChunk = options.dir.endsWith('/server');
|
|
@@ -35,7 +38,7 @@ function navitaRemix(options) {
|
|
|
35
38
|
}
|
|
36
39
|
if (isServerChunk && !hasEmittedCss) {
|
|
37
40
|
// In the server-build, we'll generate the CSS and emit it as an asset.
|
|
38
|
-
// Remix will then move it to the client assets.
|
|
41
|
+
// Remix/react-router will then move it to the client assets.
|
|
39
42
|
this.emitFile({
|
|
40
43
|
fileName: cssFileName,
|
|
41
44
|
name: 'navita.css',
|
|
@@ -48,7 +51,7 @@ function navitaRemix(options) {
|
|
|
48
51
|
}
|
|
49
52
|
];
|
|
50
53
|
}
|
|
51
|
-
const
|
|
54
|
+
const SERVER_BUILD_EXTENSION = `
|
|
52
55
|
routes.root.module = {
|
|
53
56
|
...route0,
|
|
54
57
|
links: () => [
|