@plumeria/vite-plugin 2.0.3 → 2.1.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 +12 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -13,9 +13,9 @@ export function plumeria(options = {}) {
13
13
  const targets = [];
14
14
  let config;
15
15
  let devServer;
16
+ let isDev = false;
16
17
  return {
17
18
  name: '@plumeria/vite-plugin',
18
- apply: 'serve',
19
19
  enforce: 'pre',
20
20
  config: ({ build = {} }) => ({
21
21
  build: {
@@ -30,12 +30,17 @@ export function plumeria(options = {}) {
30
30
  },
31
31
  }),
32
32
  configResolved(resolvedConfig) {
33
+ isDev = resolvedConfig.command === 'serve';
33
34
  config = resolvedConfig;
34
35
  },
35
36
  configureServer(_server) {
37
+ if (!isDev)
38
+ return;
36
39
  devServer = _server;
37
40
  },
38
41
  resolveId(importeeUrl) {
42
+ if (!isDev)
43
+ return;
39
44
  const [id] = importeeUrl.split('?', 1);
40
45
  if (cssLookup.has(id)) {
41
46
  return id;
@@ -43,10 +48,14 @@ export function plumeria(options = {}) {
43
48
  return cssFileLookup.get(id);
44
49
  },
45
50
  load(url) {
51
+ if (!isDev)
52
+ return;
46
53
  const [id] = url.split('?', 1);
47
54
  return cssLookup.get(id);
48
55
  },
49
56
  handleHotUpdate(ctx) {
57
+ if (!isDev)
58
+ return;
50
59
  if (ctx.modules.length) {
51
60
  return ctx.modules;
52
61
  }
@@ -57,6 +66,8 @@ export function plumeria(options = {}) {
57
66
  .concat(ctx.modules);
58
67
  },
59
68
  transform(source, url) {
69
+ if (!isDev)
70
+ return;
60
71
  const [id] = url.split('?', 1);
61
72
  if (id.includes('node_modules')) {
62
73
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/vite-plugin",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "description": "Plumeria Vite plugin",
6
6
  "author": "Refirst 11",
@@ -22,7 +22,7 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^2.0.3"
25
+ "@plumeria/utils": "^2.1.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.2",