vite-plugin-qingkuai 1.0.11 → 1.0.13

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": []
3
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present, all contributors to vite-plugin-qingkuai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # vite-plugin-qingkuai
2
+
3
+ vite-plugin-qingkuai is a Vite plugin that transforms `.qk` component files into native JavaScript using the Qingkuai compiler. It enables fast and seamless development of web applications built with [QingKuai](https://qingkuai.dev)(a front-end framework).
4
+
5
+ [QingKuai Documentation](https://qingkuai.dev) | [VSCode extension For QingKuai Language Features](https://marketplace.visualstudio.com/items?itemName=qingkuai-tools.qingkuai-language-features) | [Issues]("https://github.com/qingkuai-js/vite-plugin/issues)
6
+
7
+ ## Usage
8
+
9
+ ```js
10
+ import { defineConfig } from "vite"
11
+ import qingkuai from "vite-plugin-qingkuai"
12
+
13
+ export default defineConfig({
14
+ plugins: [qingkuai()]
15
+ })
16
+ ```
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var path = require('node:path');
4
- var node_fs = require('node:fs');
5
- var node_crypto = require('node:crypto');
3
+ var nodePath = require('node:path');
4
+ var nodeCrypto = require('node:crypto');
6
5
  var compiler = require('qingkuai/compiler');
6
+ var nodeFs = require('node:fs');
7
7
  var linesAndColumns = require('lines-and-columns');
8
8
  var sourcemapCodec = require('@jridgewell/sourcemap-codec');
9
9
  var postcss = require('postcss');
@@ -11,14 +11,17 @@ var selectorParser = require('postcss-selector-parser');
11
11
  var vite = require('vite');
12
12
  var sourceMapJs = require('source-map-js');
13
13
 
14
+ function isUndefined(v) {
15
+ return void 0 === v;
16
+ }
14
17
  function findFilesByName(dir, targetFileName, ignoreList) {
15
18
  const result = [];
16
- const entries = node_fs.readdirSync(dir, { withFileTypes: true });
19
+ const entries = nodeFs.readdirSync(dir, { withFileTypes: true });
17
20
  for (const entry of entries) {
18
21
  if (ignoreList.has(entry.name)) {
19
22
  continue;
20
23
  }
21
- const fullPath = path.join(dir, entry.name);
24
+ const fullPath = nodePath.join(dir, entry.name);
22
25
  if (entry.name === targetFileName) {
23
26
  result.push(fullPath);
24
27
  } else if (entry.isDirectory()) {
@@ -95,7 +98,7 @@ async function getOriginalPosition(map, line, column) {
95
98
  return new sourceMapJs.SourceMapConsumer(map).originalPositionFor({ line, column });
96
99
  }
97
100
 
98
- function qingkuaiPlugin() {
101
+ function qingkuai() {
99
102
  let isDev;
100
103
  let sourcemap;
101
104
  let cssSourcemap;
@@ -105,16 +108,8 @@ function qingkuaiPlugin() {
105
108
  const styleIdRE = /^virtual:\[\d+\].*?\.qk.(?:css|s[ac]ss|less|stylus|postcss)\?\d{13}$/;
106
109
  return {
107
110
  name: "qingkuai-compiler",
108
- config(config, env) {
109
- const rootPath = path.resolve(process.cwd(), config.root ?? "");
110
- const qingkuaiConfig = getQingkuaiConfiguration(rootPath);
111
+ config(_, env) {
111
112
  isDev = env.command === "serve";
112
- return {
113
- define: {
114
- __qk_expose_dependencies__: JSON.stringify(!!qingkuaiConfig.exposeDependencies),
115
- __qk_expose_destructions__: JSON.stringify(!!qingkuaiConfig.exposeDestructions)
116
- }
117
- };
118
113
  },
119
114
  configureServer(server) {
120
115
  createQingkuaiConfigurationWatcher(server);
@@ -128,15 +123,30 @@ function qingkuaiPlugin() {
128
123
  cssSourcemap = true;
129
124
  sourcemap = config.build.sourcemap !== false;
130
125
  }
126
+ const optimizeDeps = config.optimizeDeps;
127
+ if (!optimizeDeps) {
128
+ Object.assign(config, {
129
+ optimizeDeps: {
130
+ exclude: ["qingkuai"]
131
+ }
132
+ });
133
+ } else if (!optimizeDeps.exclude) {
134
+ optimizeDeps.exclude = ["qingkuai"];
135
+ } else {
136
+ optimizeDeps.exclude.push("qingkuai");
137
+ }
131
138
  loadAllQingkuaiConfigurations(config.root);
132
139
  },
133
140
  resolveId(id, importer) {
134
141
  if (styleIdRE.test(id)) {
135
142
  return id;
136
143
  }
137
- if (importer?.endsWith(".qk") && !path.extname(id)) {
144
+ if (importer?.endsWith(".qk") && !nodePath.extname(id)) {
138
145
  const qingkuaiConfig = getQingkuaiConfiguration(id);
139
- return path.join(path.dirname(importer), id + (qingkuaiConfig.resolveImportExtension ? ".qk" : ""));
146
+ return nodePath.join(
147
+ nodePath.dirname(importer),
148
+ id + (qingkuaiConfig.resolveImportExtension ? ".qk" : "")
149
+ );
140
150
  }
141
151
  return id;
142
152
  },
@@ -148,11 +158,11 @@ function qingkuaiPlugin() {
148
158
  }
149
159
  let virtualFileName;
150
160
  const compileRes = compileResultCache.get(fileId);
151
- const style = compileRes.inputDescriptor.styles[index];
161
+ const style = compileRes.styleDescriptors[index];
152
162
  while (true) {
153
- const hash = node_crypto.randomBytes(6).toString("hex");
163
+ const hash = nodeCrypto.randomBytes(6).toString("hex");
154
164
  virtualFileName = `${fileId}.${hash}.${style.lang}`;
155
- if (!node_fs.existsSync(virtualFileName)) {
165
+ if (!nodeFs.existsSync(virtualFileName)) {
156
166
  break;
157
167
  }
158
168
  }
@@ -196,7 +206,7 @@ function qingkuaiPlugin() {
196
206
  line: preprocessedPosition.line - 1,
197
207
  column: preprocessedPosition.column
198
208
  }) || 0;
199
- const position = compileRes.inputDescriptor.positions[style.loc.start.index + preprocessedIndex];
209
+ const position = compileRes.positions[style.loc.start.index + preprocessedIndex];
200
210
  this.error({
201
211
  message: attachScopeResult.error.message,
202
212
  loc: {
@@ -224,11 +234,11 @@ function qingkuaiPlugin() {
224
234
  }
225
235
  try {
226
236
  const compileRes = compiler.compile(src, {
237
+ ...getCompileOptions(id),
227
238
  sourcemap,
228
239
  debug: isDev,
229
- hashId: compileResultCache.get(id)?.hashId || void 0,
230
- componentName: compiler.util.kebab2Camel(path.basename(id, path.extname(id)), true),
231
- reserveTemplateComment: getReserveHtmlComments(getQingkuaiConfiguration(id))
240
+ hashId: compileResultCache.get(id)?.hashId,
241
+ componentName: compiler.util.kebab2Camel(nodePath.basename(id, nodePath.extname(id)), true)
232
242
  });
233
243
  compileRes.messages.forEach(({ type, value: warning }) => {
234
244
  if (type === "warning") {
@@ -237,7 +247,7 @@ function qingkuaiPlugin() {
237
247
  });
238
248
  compileResultCache.set(id, compileRes);
239
249
  const compiledCodeArr = [compileRes.code];
240
- compileRes.inputDescriptor.styles.forEach((_, index) => {
250
+ compileRes.styleDescriptors.forEach((_, index) => {
241
251
  compiledCodeArr.push(`import "virtual:[${index}]${id}.css?${Date.now()}"`);
242
252
  });
243
253
  const baseMap = {
@@ -246,7 +256,7 @@ function qingkuaiPlugin() {
246
256
  sourcesContent: [src]
247
257
  };
248
258
  const compiledCode = compiledCodeArr.join("\n");
249
- if (!compileRes.inputDescriptor.script.isTS) {
259
+ if (!compileRes.scriptDescriptor.isTS) {
250
260
  if (!sourcemap) {
251
261
  return compiledCode;
252
262
  }
@@ -288,14 +298,12 @@ function qingkuaiPlugin() {
288
298
  };
289
299
  function getQingkuaiConfiguration(id) {
290
300
  let config = {
291
- insertTipComments: true,
292
- exposeDestructions: isDev,
293
- exposeDependencies: isDev,
301
+ interpretiveComments: true,
294
302
  resolveImportExtension: true,
295
- reserveHtmlComments: "development"
303
+ preserveHtmlComments: "development"
296
304
  };
297
305
  while (true) {
298
- const dir = path.dirname(id);
306
+ const dir = nodePath.dirname(id);
299
307
  if (dir === id) {
300
308
  break;
301
309
  }
@@ -307,21 +315,9 @@ function qingkuaiPlugin() {
307
315
  }
308
316
  return config;
309
317
  }
310
- function getReserveHtmlComments(config) {
311
- switch (config.reserveHtmlComments) {
312
- case "all":
313
- return true;
314
- case "never":
315
- return false;
316
- case "production":
317
- return !isDev;
318
- default:
319
- return isDev;
320
- }
321
- }
322
318
  function createQingkuaiConfigurationWatcher(server) {
323
319
  const watcher = server.watcher.add([".qingkuairc", "!**/node_modules/**"]);
324
- watcher.on("unlink", (p) => qingkuaiConfigurations.delete(path.dirname(p)));
320
+ watcher.on("unlink", (p) => qingkuaiConfigurations.delete(nodePath.dirname(p)));
325
321
  watcher.on("change", recordQingkuaiConfiguration);
326
322
  watcher.on("add", recordQingkuaiConfiguration);
327
323
  }
@@ -332,10 +328,50 @@ function qingkuaiPlugin() {
332
328
  }
333
329
  function recordQingkuaiConfiguration(fileName) {
334
330
  try {
335
- qingkuaiConfigurations.set(path.dirname(fileName), JSON.parse(node_fs.readFileSync(fileName, "utf-8")));
331
+ qingkuaiConfigurations.set(nodePath.dirname(fileName), JSON.parse(nodeFs.readFileSync(fileName, "utf-8")));
336
332
  } catch {
337
333
  }
338
334
  }
335
+ function getCompileOptions(id) {
336
+ const qingkuaiConfig = getQingkuaiConfiguration(id);
337
+ const ret = {
338
+ interpretiveComments: isUndefined(qingkuaiConfig.interpretiveComments) ? isDev : !!qingkuaiConfig.interpretiveComments,
339
+ shorthandDerivedDeclaration: isUndefined(qingkuaiConfig.shorthandDerivedDeclaration) ? true : !!qingkuaiConfig.shorthandDerivedDeclaration,
340
+ reactivityMode: qingkuaiConfig.reactivityMode === "shallow" ? "shallow" : "reactive"
341
+ };
342
+ switch (qingkuaiConfig.whitespace) {
343
+ case "trim":
344
+ case "collapse":
345
+ case "preserve":
346
+ case "trim-collapse": {
347
+ ret.whitespace = qingkuaiConfig.whitespace;
348
+ break;
349
+ }
350
+ default: {
351
+ ret.whitespace = "trim-collapse";
352
+ break;
353
+ }
354
+ }
355
+ switch (qingkuaiConfig.preserveHtmlComments) {
356
+ case "all": {
357
+ ret.preserveHtmlComments = true;
358
+ break;
359
+ }
360
+ case "never": {
361
+ ret.preserveHtmlComments = false;
362
+ break;
363
+ }
364
+ case "production": {
365
+ ret.preserveHtmlComments = !isDev;
366
+ break;
367
+ }
368
+ default: {
369
+ ret.preserveHtmlComments = isDev;
370
+ break;
371
+ }
372
+ }
373
+ return ret;
374
+ }
339
375
  }
340
376
  function parseStyleId(id) {
341
377
  const m1 = /^virtual:\[(\d+)\]/.exec(id);
@@ -352,4 +388,4 @@ function parseStyleId(id) {
352
388
  };
353
389
  }
354
390
 
355
- module.exports = qingkuaiPlugin;
391
+ module.exports = qingkuai;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PluginOption } from 'vite';
2
2
 
3
- declare function qingkuaiPlugin(): PluginOption;
3
+ declare function qingkuai(): PluginOption;
4
4
 
5
- export { qingkuaiPlugin as default };
5
+ export { qingkuai as default };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import path, { join } from 'node:path';
2
- import { readdirSync, existsSync, readFileSync } from 'node:fs';
3
- import { randomBytes } from 'node:crypto';
1
+ import nodePath from 'node:path';
2
+ import nodeCrypto from 'node:crypto';
4
3
  import { compile, util } from 'qingkuai/compiler';
4
+ import nodeFs, { existsSync, readFileSync } from 'node:fs';
5
5
  import { LinesAndColumns } from 'lines-and-columns';
6
6
  import { decode, encode } from '@jridgewell/sourcemap-codec';
7
7
  import postcss from 'postcss';
@@ -9,14 +9,17 @@ import selectorParser from 'postcss-selector-parser';
9
9
  import { transformWithEsbuild, preprocessCSS } from 'vite';
10
10
  import { SourceMapConsumer } from 'source-map-js';
11
11
 
12
+ function isUndefined(v) {
13
+ return void 0 === v;
14
+ }
12
15
  function findFilesByName(dir, targetFileName, ignoreList) {
13
16
  const result = [];
14
- const entries = readdirSync(dir, { withFileTypes: true });
17
+ const entries = nodeFs.readdirSync(dir, { withFileTypes: true });
15
18
  for (const entry of entries) {
16
19
  if (ignoreList.has(entry.name)) {
17
20
  continue;
18
21
  }
19
- const fullPath = join(dir, entry.name);
22
+ const fullPath = nodePath.join(dir, entry.name);
20
23
  if (entry.name === targetFileName) {
21
24
  result.push(fullPath);
22
25
  } else if (entry.isDirectory()) {
@@ -93,7 +96,7 @@ async function getOriginalPosition(map, line, column) {
93
96
  return new SourceMapConsumer(map).originalPositionFor({ line, column });
94
97
  }
95
98
 
96
- function qingkuaiPlugin() {
99
+ function qingkuai() {
97
100
  let isDev;
98
101
  let sourcemap;
99
102
  let cssSourcemap;
@@ -103,16 +106,8 @@ function qingkuaiPlugin() {
103
106
  const styleIdRE = /^virtual:\[\d+\].*?\.qk.(?:css|s[ac]ss|less|stylus|postcss)\?\d{13}$/;
104
107
  return {
105
108
  name: "qingkuai-compiler",
106
- config(config, env) {
107
- const rootPath = path.resolve(process.cwd(), config.root ?? "");
108
- const qingkuaiConfig = getQingkuaiConfiguration(rootPath);
109
+ config(_, env) {
109
110
  isDev = env.command === "serve";
110
- return {
111
- define: {
112
- __qk_expose_dependencies__: JSON.stringify(!!qingkuaiConfig.exposeDependencies),
113
- __qk_expose_destructions__: JSON.stringify(!!qingkuaiConfig.exposeDestructions)
114
- }
115
- };
116
111
  },
117
112
  configureServer(server) {
118
113
  createQingkuaiConfigurationWatcher(server);
@@ -126,15 +121,30 @@ function qingkuaiPlugin() {
126
121
  cssSourcemap = true;
127
122
  sourcemap = config.build.sourcemap !== false;
128
123
  }
124
+ const optimizeDeps = config.optimizeDeps;
125
+ if (!optimizeDeps) {
126
+ Object.assign(config, {
127
+ optimizeDeps: {
128
+ exclude: ["qingkuai"]
129
+ }
130
+ });
131
+ } else if (!optimizeDeps.exclude) {
132
+ optimizeDeps.exclude = ["qingkuai"];
133
+ } else {
134
+ optimizeDeps.exclude.push("qingkuai");
135
+ }
129
136
  loadAllQingkuaiConfigurations(config.root);
130
137
  },
131
138
  resolveId(id, importer) {
132
139
  if (styleIdRE.test(id)) {
133
140
  return id;
134
141
  }
135
- if (importer?.endsWith(".qk") && !path.extname(id)) {
142
+ if (importer?.endsWith(".qk") && !nodePath.extname(id)) {
136
143
  const qingkuaiConfig = getQingkuaiConfiguration(id);
137
- return path.join(path.dirname(importer), id + (qingkuaiConfig.resolveImportExtension ? ".qk" : ""));
144
+ return nodePath.join(
145
+ nodePath.dirname(importer),
146
+ id + (qingkuaiConfig.resolveImportExtension ? ".qk" : "")
147
+ );
138
148
  }
139
149
  return id;
140
150
  },
@@ -146,9 +156,9 @@ function qingkuaiPlugin() {
146
156
  }
147
157
  let virtualFileName;
148
158
  const compileRes = compileResultCache.get(fileId);
149
- const style = compileRes.inputDescriptor.styles[index];
159
+ const style = compileRes.styleDescriptors[index];
150
160
  while (true) {
151
- const hash = randomBytes(6).toString("hex");
161
+ const hash = nodeCrypto.randomBytes(6).toString("hex");
152
162
  virtualFileName = `${fileId}.${hash}.${style.lang}`;
153
163
  if (!existsSync(virtualFileName)) {
154
164
  break;
@@ -194,7 +204,7 @@ function qingkuaiPlugin() {
194
204
  line: preprocessedPosition.line - 1,
195
205
  column: preprocessedPosition.column
196
206
  }) || 0;
197
- const position = compileRes.inputDescriptor.positions[style.loc.start.index + preprocessedIndex];
207
+ const position = compileRes.positions[style.loc.start.index + preprocessedIndex];
198
208
  this.error({
199
209
  message: attachScopeResult.error.message,
200
210
  loc: {
@@ -222,11 +232,11 @@ function qingkuaiPlugin() {
222
232
  }
223
233
  try {
224
234
  const compileRes = compile(src, {
235
+ ...getCompileOptions(id),
225
236
  sourcemap,
226
237
  debug: isDev,
227
- hashId: compileResultCache.get(id)?.hashId || void 0,
228
- componentName: util.kebab2Camel(path.basename(id, path.extname(id)), true),
229
- reserveTemplateComment: getReserveHtmlComments(getQingkuaiConfiguration(id))
238
+ hashId: compileResultCache.get(id)?.hashId,
239
+ componentName: util.kebab2Camel(nodePath.basename(id, nodePath.extname(id)), true)
230
240
  });
231
241
  compileRes.messages.forEach(({ type, value: warning }) => {
232
242
  if (type === "warning") {
@@ -235,7 +245,7 @@ function qingkuaiPlugin() {
235
245
  });
236
246
  compileResultCache.set(id, compileRes);
237
247
  const compiledCodeArr = [compileRes.code];
238
- compileRes.inputDescriptor.styles.forEach((_, index) => {
248
+ compileRes.styleDescriptors.forEach((_, index) => {
239
249
  compiledCodeArr.push(`import "virtual:[${index}]${id}.css?${Date.now()}"`);
240
250
  });
241
251
  const baseMap = {
@@ -244,7 +254,7 @@ function qingkuaiPlugin() {
244
254
  sourcesContent: [src]
245
255
  };
246
256
  const compiledCode = compiledCodeArr.join("\n");
247
- if (!compileRes.inputDescriptor.script.isTS) {
257
+ if (!compileRes.scriptDescriptor.isTS) {
248
258
  if (!sourcemap) {
249
259
  return compiledCode;
250
260
  }
@@ -286,14 +296,12 @@ function qingkuaiPlugin() {
286
296
  };
287
297
  function getQingkuaiConfiguration(id) {
288
298
  let config = {
289
- insertTipComments: true,
290
- exposeDestructions: isDev,
291
- exposeDependencies: isDev,
299
+ interpretiveComments: true,
292
300
  resolveImportExtension: true,
293
- reserveHtmlComments: "development"
301
+ preserveHtmlComments: "development"
294
302
  };
295
303
  while (true) {
296
- const dir = path.dirname(id);
304
+ const dir = nodePath.dirname(id);
297
305
  if (dir === id) {
298
306
  break;
299
307
  }
@@ -305,21 +313,9 @@ function qingkuaiPlugin() {
305
313
  }
306
314
  return config;
307
315
  }
308
- function getReserveHtmlComments(config) {
309
- switch (config.reserveHtmlComments) {
310
- case "all":
311
- return true;
312
- case "never":
313
- return false;
314
- case "production":
315
- return !isDev;
316
- default:
317
- return isDev;
318
- }
319
- }
320
316
  function createQingkuaiConfigurationWatcher(server) {
321
317
  const watcher = server.watcher.add([".qingkuairc", "!**/node_modules/**"]);
322
- watcher.on("unlink", (p) => qingkuaiConfigurations.delete(path.dirname(p)));
318
+ watcher.on("unlink", (p) => qingkuaiConfigurations.delete(nodePath.dirname(p)));
323
319
  watcher.on("change", recordQingkuaiConfiguration);
324
320
  watcher.on("add", recordQingkuaiConfiguration);
325
321
  }
@@ -330,10 +326,50 @@ function qingkuaiPlugin() {
330
326
  }
331
327
  function recordQingkuaiConfiguration(fileName) {
332
328
  try {
333
- qingkuaiConfigurations.set(path.dirname(fileName), JSON.parse(readFileSync(fileName, "utf-8")));
329
+ qingkuaiConfigurations.set(nodePath.dirname(fileName), JSON.parse(readFileSync(fileName, "utf-8")));
334
330
  } catch {
335
331
  }
336
332
  }
333
+ function getCompileOptions(id) {
334
+ const qingkuaiConfig = getQingkuaiConfiguration(id);
335
+ const ret = {
336
+ interpretiveComments: isUndefined(qingkuaiConfig.interpretiveComments) ? isDev : !!qingkuaiConfig.interpretiveComments,
337
+ shorthandDerivedDeclaration: isUndefined(qingkuaiConfig.shorthandDerivedDeclaration) ? true : !!qingkuaiConfig.shorthandDerivedDeclaration,
338
+ reactivityMode: qingkuaiConfig.reactivityMode === "shallow" ? "shallow" : "reactive"
339
+ };
340
+ switch (qingkuaiConfig.whitespace) {
341
+ case "trim":
342
+ case "collapse":
343
+ case "preserve":
344
+ case "trim-collapse": {
345
+ ret.whitespace = qingkuaiConfig.whitespace;
346
+ break;
347
+ }
348
+ default: {
349
+ ret.whitespace = "trim-collapse";
350
+ break;
351
+ }
352
+ }
353
+ switch (qingkuaiConfig.preserveHtmlComments) {
354
+ case "all": {
355
+ ret.preserveHtmlComments = true;
356
+ break;
357
+ }
358
+ case "never": {
359
+ ret.preserveHtmlComments = false;
360
+ break;
361
+ }
362
+ case "production": {
363
+ ret.preserveHtmlComments = !isDev;
364
+ break;
365
+ }
366
+ default: {
367
+ ret.preserveHtmlComments = isDev;
368
+ break;
369
+ }
370
+ }
371
+ return ret;
372
+ }
337
373
  }
338
374
  function parseStyleId(id) {
339
375
  const m1 = /^virtual:\[(\d+)\]/.exec(id);
@@ -350,5 +386,5 @@ function parseStyleId(id) {
350
386
  };
351
387
  }
352
388
 
353
- export { qingkuaiPlugin as default };
389
+ export { qingkuai as default };
354
390
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vite-plugin-qingkuai",
3
3
  "author": "mlgq",
4
4
  "license": "MIT",
5
- "version": "1.0.11",
5
+ "version": "1.0.13",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "vite",
@@ -25,7 +25,7 @@
25
25
  "@types/fs-extra": "^11.0.4",
26
26
  "@types/node": "^22.13.14",
27
27
  "fs-extra": "^11.3.0",
28
- "qingkuai": "^1.0.43",
28
+ "qingkuai": "^1.0.45",
29
29
  "rimraf": "^6.0.1",
30
30
  "rollup": "^4.38.0",
31
31
  "rollup-plugin-dts": "^6.2.1",
@@ -33,7 +33,7 @@
33
33
  "vite": "^6.2.4"
34
34
  },
35
35
  "peerDependencies": {
36
- "qingkuai": "^1.0.43",
36
+ "qingkuai": "^1.0.45",
37
37
  "vite": "^6.2.4"
38
38
  },
39
39
  "dependencies": {