@pikacss/vite-plugin-pikacss 0.0.14 → 0.0.16

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.cjs CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const integration = require('@pikacss/integration');
6
6
  const vite = require('vite');
7
7
  const pathe = require('pathe');
8
- const perfectDebounce = require('perfect-debounce');
9
8
 
10
9
  const VIRTUAL_PIKA_CSS_ID = "virtual:pika.css";
11
10
  const SHARED_PLUGIN_NAME = "pikacss:shared";
@@ -95,15 +94,6 @@ function build(getCtx) {
95
94
 
96
95
  function dev(getCtx) {
97
96
  let ctx = null;
98
- const updateDevCssFile = perfectDebounce.debounce(async () => {
99
- await ctx.writeDevCssFile();
100
- }, 300);
101
- const updateTsCodegenFile = perfectDebounce.debounce(async () => {
102
- await ctx.writeTsCodegenFile();
103
- }, 300);
104
- const reloadCtx = perfectDebounce.debounce(async () => {
105
- await ctx.init();
106
- }, 300);
107
97
  return {
108
98
  name: DEV_PLUGIN_NAME,
109
99
  enforce: "pre",
@@ -119,7 +109,7 @@ function dev(getCtx) {
119
109
  async function handleFileChange(file) {
120
110
  if (ctx.configSources.includes(file)) {
121
111
  const moduleIds = Array.from(ctx.usages.keys());
122
- await reloadCtx();
112
+ await ctx.init();
123
113
  moduleIds.forEach((id) => {
124
114
  const mod = server.moduleGraph.getModuleById(id);
125
115
  if (mod) {
@@ -131,10 +121,8 @@ function dev(getCtx) {
131
121
  }
132
122
  },
133
123
  buildStart() {
134
- ctx.hooks.styleUpdated.on(() => updateDevCssFile());
135
- ctx.hooks.tsCodegenUpdated.on(() => updateTsCodegenFile());
136
- updateDevCssFile();
137
- updateTsCodegenFile();
124
+ ctx.hooks.styleUpdated.on(() => ctx.writeDevCssFile());
125
+ ctx.hooks.tsCodegenUpdated.on(() => ctx.writeTsCodegenFile());
138
126
  },
139
127
  resolveId(id) {
140
128
  if (id === VIRTUAL_PIKA_CSS_ID)
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@ import { createCtx } from '@pikacss/integration';
2
2
  export * from '@pikacss/integration';
3
3
  import { transformWithEsbuild } from 'vite';
4
4
  import { resolve } from 'pathe';
5
- import { debounce } from 'perfect-debounce';
6
5
 
7
6
  const VIRTUAL_PIKA_CSS_ID = "virtual:pika.css";
8
7
  const SHARED_PLUGIN_NAME = "pikacss:shared";
@@ -92,15 +91,6 @@ function build(getCtx) {
92
91
 
93
92
  function dev(getCtx) {
94
93
  let ctx = null;
95
- const updateDevCssFile = debounce(async () => {
96
- await ctx.writeDevCssFile();
97
- }, 300);
98
- const updateTsCodegenFile = debounce(async () => {
99
- await ctx.writeTsCodegenFile();
100
- }, 300);
101
- const reloadCtx = debounce(async () => {
102
- await ctx.init();
103
- }, 300);
104
94
  return {
105
95
  name: DEV_PLUGIN_NAME,
106
96
  enforce: "pre",
@@ -116,7 +106,7 @@ function dev(getCtx) {
116
106
  async function handleFileChange(file) {
117
107
  if (ctx.configSources.includes(file)) {
118
108
  const moduleIds = Array.from(ctx.usages.keys());
119
- await reloadCtx();
109
+ await ctx.init();
120
110
  moduleIds.forEach((id) => {
121
111
  const mod = server.moduleGraph.getModuleById(id);
122
112
  if (mod) {
@@ -128,10 +118,8 @@ function dev(getCtx) {
128
118
  }
129
119
  },
130
120
  buildStart() {
131
- ctx.hooks.styleUpdated.on(() => updateDevCssFile());
132
- ctx.hooks.tsCodegenUpdated.on(() => updateTsCodegenFile());
133
- updateDevCssFile();
134
- updateTsCodegenFile();
121
+ ctx.hooks.styleUpdated.on(() => ctx.writeDevCssFile());
122
+ ctx.hooks.tsCodegenUpdated.on(() => ctx.writeTsCodegenFile());
135
123
  },
136
124
  resolveId(id) {
137
125
  if (id === VIRTUAL_PIKA_CSS_ID)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.14",
7
+ "version": "0.0.16",
8
8
  "author": "DevilTea <ch19980814@gmail.com>",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -38,8 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "pathe": "^2.0.3",
41
- "perfect-debounce": "^1.0.0",
42
- "@pikacss/integration": "0.0.14"
41
+ "@pikacss/integration": "0.0.16"
43
42
  },
44
43
  "devDependencies": {
45
44
  "vite": "^6.1.1"