vite-plugin-qingkuai 1.0.25 → 1.0.27
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 +81 -58
- package/dist/index.js +81 -58
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var vite = require('vite');
|
|
4
4
|
var nodeFs = require('node:fs');
|
|
5
|
+
var nodeUrl = require('node:url');
|
|
5
6
|
var nodePath = require('node:path');
|
|
6
7
|
var nodeCrypto = require('node:crypto');
|
|
7
|
-
var compiler = require('qingkuai/compiler');
|
|
8
8
|
var linesAndColumns = require('lines-and-columns');
|
|
9
9
|
var sourcemapCodec = require('@jridgewell/sourcemap-codec');
|
|
10
10
|
var postcss = require('postcss');
|
|
11
11
|
var selectorParser = require('postcss-selector-parser');
|
|
12
|
+
var compiler = require('qingkuai/compiler');
|
|
12
13
|
var sourceMapJs = require('source-map-js');
|
|
13
14
|
|
|
14
15
|
function _interopNamespaceDefault(e) {
|
|
@@ -30,29 +31,6 @@ function _interopNamespaceDefault(e) {
|
|
|
30
31
|
|
|
31
32
|
var vite__namespace = /*#__PURE__*/_interopNamespaceDefault(vite);
|
|
32
33
|
|
|
33
|
-
function isNumber(v) {
|
|
34
|
-
return typeof v === "number";
|
|
35
|
-
}
|
|
36
|
-
function isUndefined(v) {
|
|
37
|
-
return void 0 === v;
|
|
38
|
-
}
|
|
39
|
-
function findFilesByName(dir, targetFileName, ignoreList) {
|
|
40
|
-
const result = [];
|
|
41
|
-
const entries = nodeFs.readdirSync(dir, { withFileTypes: true });
|
|
42
|
-
for (const entry of entries) {
|
|
43
|
-
if (ignoreList.has(entry.name)) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const fullPath = nodePath.join(dir, entry.name);
|
|
47
|
-
if (entry.name === targetFileName) {
|
|
48
|
-
result.push(fullPath);
|
|
49
|
-
} else if (entry.isDirectory()) {
|
|
50
|
-
result.push(...findFilesByName(fullPath, targetFileName, ignoreList));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
34
|
async function attachScopeForStyleSelectors(code, hash, sourceFile, map) {
|
|
57
35
|
let error;
|
|
58
36
|
const processedRules = /* @__PURE__ */ new WeakSet();
|
|
@@ -100,11 +78,11 @@ async function attachScopeForStyleSelectors(code, hash, sourceFile, map) {
|
|
|
100
78
|
}
|
|
101
79
|
]);
|
|
102
80
|
const ret = await processor.process(code, {
|
|
103
|
-
from: sourceFile,
|
|
104
81
|
map: {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
82
|
+
annotation: false,
|
|
83
|
+
prev: map?.version ? map : void 0
|
|
84
|
+
},
|
|
85
|
+
from: sourceFile
|
|
108
86
|
});
|
|
109
87
|
const outputMap = ret.map?.toJSON();
|
|
110
88
|
return {
|
|
@@ -126,10 +104,34 @@ const globalStyle = "\n" + compiler.util.formatSourceCode(
|
|
|
126
104
|
).replace(/^/gm, " ") + "\n";
|
|
127
105
|
const VIRTUAL_STYLE_ID_RE = /^virtual:\[\d+\].*?\.qk\.(css|s[ac]ss|less|stylus|postcss)\?\d{13}$/;
|
|
128
106
|
|
|
129
|
-
function
|
|
107
|
+
function isNumber(v) {
|
|
108
|
+
return typeof v === "number";
|
|
109
|
+
}
|
|
110
|
+
function isUndefined(v) {
|
|
111
|
+
return void 0 === v;
|
|
112
|
+
}
|
|
113
|
+
function findFilesByName(dir, targetFileName, ignoreList) {
|
|
114
|
+
const result = [];
|
|
115
|
+
const entries = nodeFs.readdirSync(dir, { withFileTypes: true });
|
|
116
|
+
for (const entry of entries) {
|
|
117
|
+
if (ignoreList.has(entry.name)) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const fullPath = nodePath.join(dir, entry.name);
|
|
121
|
+
if (entry.name === targetFileName) {
|
|
122
|
+
result.push(fullPath);
|
|
123
|
+
} else if (entry.isDirectory()) {
|
|
124
|
+
result.push(...findFilesByName(fullPath, targetFileName, ignoreList));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function offsetSourceMap(sourceIndices, mappings, preLine, preColumn) {
|
|
131
|
+
const indices = new Set(sourceIndices);
|
|
130
132
|
return sourcemapCodec.decode(mappings).map((line) => {
|
|
131
133
|
return line.map((segment) => {
|
|
132
|
-
if (segment.length === 1 || segment[1]
|
|
134
|
+
if (segment.length === 1 || !indices.has(segment[1])) {
|
|
133
135
|
return segment;
|
|
134
136
|
}
|
|
135
137
|
if (segment[2] === preLine) {
|
|
@@ -273,9 +275,11 @@ Caused by: "${fileId}".`;
|
|
|
273
275
|
}
|
|
274
276
|
return this.error(err);
|
|
275
277
|
}
|
|
278
|
+
preprocessRes.deps?.forEach((dep) => this.addWatchFile(dep));
|
|
276
279
|
if (!cssSourcemap || styleDescriptor.global) {
|
|
277
280
|
return preprocessRes;
|
|
278
281
|
}
|
|
282
|
+
const phantomIndices = [];
|
|
279
283
|
const assertedPreprocessMap = preprocessRes.map;
|
|
280
284
|
const attachScopeResult = await attachScopeForStyleSelectors(
|
|
281
285
|
preprocessRes.code,
|
|
@@ -284,15 +288,28 @@ Caused by: "${fileId}".`;
|
|
|
284
288
|
assertedPreprocessMap
|
|
285
289
|
);
|
|
286
290
|
const attachScopeMap = attachScopeResult.map ?? assertedPreprocessMap;
|
|
287
|
-
const
|
|
288
|
-
|
|
291
|
+
const sameVirtualSource = (source) => {
|
|
292
|
+
let resolved = source.startsWith("file://") ? nodeUrl.fileURLToPath(source) : source;
|
|
293
|
+
if (!nodePath.isAbsolute(resolved)) {
|
|
294
|
+
const candidates = [
|
|
295
|
+
nodePath.resolve(nodePath.dirname(virtualFileName), resolved),
|
|
296
|
+
nodePath.resolve(resolved)
|
|
297
|
+
];
|
|
298
|
+
return candidates.some(
|
|
299
|
+
(candidate) => nodePath.normalize(candidate) === nodePath.normalize(virtualFileName)
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
return nodePath.normalize(resolved) === nodePath.normalize(virtualFileName);
|
|
289
303
|
};
|
|
290
|
-
|
|
291
|
-
|
|
304
|
+
attachScopeMap?.sources.forEach((source, index2) => {
|
|
305
|
+
if (sameVirtualSource(source)) {
|
|
306
|
+
phantomIndices.push(index2);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
292
309
|
const offsetMappings = sourcemapCodec.encode(
|
|
293
310
|
offsetSourceMap(
|
|
311
|
+
phantomIndices,
|
|
294
312
|
attachScopeResult.mappings,
|
|
295
|
-
currentSourceIndex,
|
|
296
313
|
styleDescriptor.loc.start.line - 1,
|
|
297
314
|
styleDescriptor.loc.start.column - 1
|
|
298
315
|
)
|
|
@@ -306,7 +323,7 @@ Caused by: "${fileId}".`;
|
|
|
306
323
|
attachScopeResult.error.loc.line,
|
|
307
324
|
attachScopeResult.error.loc.column
|
|
308
325
|
);
|
|
309
|
-
if (preprocessedPosition.source && !
|
|
326
|
+
if (preprocessedPosition.source && !sameVirtualSource(preprocessedPosition.source)) {
|
|
310
327
|
this.error({
|
|
311
328
|
message: attachScopeResult.error.message,
|
|
312
329
|
loc: {
|
|
@@ -337,20 +354,17 @@ Caused by: "${fileId}".`;
|
|
|
337
354
|
version: 3,
|
|
338
355
|
mappings: offsetMappings,
|
|
339
356
|
names: attachScopeMap?.names || assertedPreprocessMap?.names || [],
|
|
340
|
-
sources: attachScopeMap?.sources
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
return sourcesContent;
|
|
353
|
-
})() : void 0
|
|
357
|
+
sources: attachScopeMap?.sources.map((source, index2) => {
|
|
358
|
+
return phantomIndices.includes(index2) ? fileId : source;
|
|
359
|
+
}) ?? [
|
|
360
|
+
...assertedPreprocessMap?.sources.filter((source) => {
|
|
361
|
+
return !sameVirtualSource(source);
|
|
362
|
+
}) ?? [],
|
|
363
|
+
fileId
|
|
364
|
+
],
|
|
365
|
+
sourcesContent: attachScopeMap?.sourcesContent?.map((content, index2) => {
|
|
366
|
+
return phantomIndices.includes(index2) ? nodeFs.readFileSync(fileId, "utf-8") : content;
|
|
367
|
+
})
|
|
354
368
|
}
|
|
355
369
|
};
|
|
356
370
|
},
|
|
@@ -394,14 +408,14 @@ Caused by: "${fileId}".`;
|
|
|
394
408
|
}
|
|
395
409
|
const transformWithOxc = vite__namespace.transformWithOxc;
|
|
396
410
|
const transformWithEsbuild = vite__namespace.transformWithEsbuild;
|
|
397
|
-
const
|
|
411
|
+
const tsTransform = transformWithOxc ?? transformWithEsbuild;
|
|
412
|
+
const tsCompileRes = await tsTransform(
|
|
398
413
|
compiledCode,
|
|
399
414
|
id,
|
|
400
415
|
{
|
|
401
416
|
sourcemap,
|
|
402
|
-
|
|
403
|
-
loader: "ts"
|
|
404
|
-
target: "esnext"
|
|
417
|
+
target: "esnext",
|
|
418
|
+
[transformWithOxc ? "lang" : "loader"]: "ts"
|
|
405
419
|
},
|
|
406
420
|
sourcemap ? {
|
|
407
421
|
version: 3,
|
|
@@ -429,9 +443,17 @@ Caused by: "${fileId}".`;
|
|
|
429
443
|
};
|
|
430
444
|
} catch (err) {
|
|
431
445
|
if (compiler.isCompileError(err)) {
|
|
432
|
-
|
|
446
|
+
const location = new linesAndColumns.LinesAndColumns(src).locationForIndex(err.loc.start.index) || void 0;
|
|
447
|
+
this.error({
|
|
448
|
+
loc: location && {
|
|
449
|
+
file: id,
|
|
450
|
+
line: location.line + 1,
|
|
451
|
+
column: location.column
|
|
452
|
+
},
|
|
453
|
+
message: err.message
|
|
454
|
+
});
|
|
433
455
|
} else if (err.cause && isNumber(err.cause.pos)) {
|
|
434
|
-
this.error(
|
|
456
|
+
this.error({ message: err.message });
|
|
435
457
|
} else {
|
|
436
458
|
this.error(
|
|
437
459
|
"Qingkuai compile result is invalid. Please report this at https://github.com/qingkuai-js/qingkuai/issues and include your .qk source for reproduction."
|
|
@@ -495,7 +517,8 @@ Caused by: "${fileId}".`;
|
|
|
495
517
|
const qingkuaiConfig = getQingkuaiConfiguration(id);
|
|
496
518
|
const ret = {
|
|
497
519
|
interpretiveComments: isUndefined(qingkuaiConfig.interpretiveComments) ? isDev : !!qingkuaiConfig.interpretiveComments,
|
|
498
|
-
|
|
520
|
+
allowConstReactive: qingkuaiConfig.allowConstReactive !== false,
|
|
521
|
+
requireReactivityMark: qingkuaiConfig.requireReactivityMark === true,
|
|
499
522
|
reactivityMode: qingkuaiConfig.reactivityMode === "shallow" ? "shallow" : "reactive"
|
|
500
523
|
};
|
|
501
524
|
switch (qingkuaiConfig.whitespace) {
|
|
@@ -512,7 +535,7 @@ Caused by: "${fileId}".`;
|
|
|
512
535
|
}
|
|
513
536
|
}
|
|
514
537
|
switch (qingkuaiConfig.preserveHtmlComments) {
|
|
515
|
-
case "
|
|
538
|
+
case "always": {
|
|
516
539
|
ret.preserveHtmlComments = true;
|
|
517
540
|
break;
|
|
518
541
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,15 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import nodeFs from 'node:fs';
|
|
3
|
+
import nodeUrl from 'node:url';
|
|
3
4
|
import nodePath from 'node:path';
|
|
4
5
|
import nodeCrypto from 'node:crypto';
|
|
5
|
-
import { util, compile, isCompileError } from 'qingkuai/compiler';
|
|
6
6
|
import { LinesAndColumns } from 'lines-and-columns';
|
|
7
7
|
import { decode, encode } from '@jridgewell/sourcemap-codec';
|
|
8
8
|
import postcss from 'postcss';
|
|
9
9
|
import selectorParser from 'postcss-selector-parser';
|
|
10
|
+
import { util, compile, isCompileError } from 'qingkuai/compiler';
|
|
10
11
|
import { SourceMapConsumer } from 'source-map-js';
|
|
11
12
|
|
|
12
|
-
function isNumber(v) {
|
|
13
|
-
return typeof v === "number";
|
|
14
|
-
}
|
|
15
|
-
function isUndefined(v) {
|
|
16
|
-
return void 0 === v;
|
|
17
|
-
}
|
|
18
|
-
function findFilesByName(dir, targetFileName, ignoreList) {
|
|
19
|
-
const result = [];
|
|
20
|
-
const entries = nodeFs.readdirSync(dir, { withFileTypes: true });
|
|
21
|
-
for (const entry of entries) {
|
|
22
|
-
if (ignoreList.has(entry.name)) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
const fullPath = nodePath.join(dir, entry.name);
|
|
26
|
-
if (entry.name === targetFileName) {
|
|
27
|
-
result.push(fullPath);
|
|
28
|
-
} else if (entry.isDirectory()) {
|
|
29
|
-
result.push(...findFilesByName(fullPath, targetFileName, ignoreList));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
13
|
async function attachScopeForStyleSelectors(code, hash, sourceFile, map) {
|
|
36
14
|
let error;
|
|
37
15
|
const processedRules = /* @__PURE__ */ new WeakSet();
|
|
@@ -79,11 +57,11 @@ async function attachScopeForStyleSelectors(code, hash, sourceFile, map) {
|
|
|
79
57
|
}
|
|
80
58
|
]);
|
|
81
59
|
const ret = await processor.process(code, {
|
|
82
|
-
from: sourceFile,
|
|
83
60
|
map: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
61
|
+
annotation: false,
|
|
62
|
+
prev: map?.version ? map : void 0
|
|
63
|
+
},
|
|
64
|
+
from: sourceFile
|
|
87
65
|
});
|
|
88
66
|
const outputMap = ret.map?.toJSON();
|
|
89
67
|
return {
|
|
@@ -105,10 +83,34 @@ const globalStyle = "\n" + util.formatSourceCode(
|
|
|
105
83
|
).replace(/^/gm, " ") + "\n";
|
|
106
84
|
const VIRTUAL_STYLE_ID_RE = /^virtual:\[\d+\].*?\.qk\.(css|s[ac]ss|less|stylus|postcss)\?\d{13}$/;
|
|
107
85
|
|
|
108
|
-
function
|
|
86
|
+
function isNumber(v) {
|
|
87
|
+
return typeof v === "number";
|
|
88
|
+
}
|
|
89
|
+
function isUndefined(v) {
|
|
90
|
+
return void 0 === v;
|
|
91
|
+
}
|
|
92
|
+
function findFilesByName(dir, targetFileName, ignoreList) {
|
|
93
|
+
const result = [];
|
|
94
|
+
const entries = nodeFs.readdirSync(dir, { withFileTypes: true });
|
|
95
|
+
for (const entry of entries) {
|
|
96
|
+
if (ignoreList.has(entry.name)) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const fullPath = nodePath.join(dir, entry.name);
|
|
100
|
+
if (entry.name === targetFileName) {
|
|
101
|
+
result.push(fullPath);
|
|
102
|
+
} else if (entry.isDirectory()) {
|
|
103
|
+
result.push(...findFilesByName(fullPath, targetFileName, ignoreList));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function offsetSourceMap(sourceIndices, mappings, preLine, preColumn) {
|
|
110
|
+
const indices = new Set(sourceIndices);
|
|
109
111
|
return decode(mappings).map((line) => {
|
|
110
112
|
return line.map((segment) => {
|
|
111
|
-
if (segment.length === 1 || segment[1]
|
|
113
|
+
if (segment.length === 1 || !indices.has(segment[1])) {
|
|
112
114
|
return segment;
|
|
113
115
|
}
|
|
114
116
|
if (segment[2] === preLine) {
|
|
@@ -252,9 +254,11 @@ Caused by: "${fileId}".`;
|
|
|
252
254
|
}
|
|
253
255
|
return this.error(err);
|
|
254
256
|
}
|
|
257
|
+
preprocessRes.deps?.forEach((dep) => this.addWatchFile(dep));
|
|
255
258
|
if (!cssSourcemap || styleDescriptor.global) {
|
|
256
259
|
return preprocessRes;
|
|
257
260
|
}
|
|
261
|
+
const phantomIndices = [];
|
|
258
262
|
const assertedPreprocessMap = preprocessRes.map;
|
|
259
263
|
const attachScopeResult = await attachScopeForStyleSelectors(
|
|
260
264
|
preprocessRes.code,
|
|
@@ -263,15 +267,28 @@ Caused by: "${fileId}".`;
|
|
|
263
267
|
assertedPreprocessMap
|
|
264
268
|
);
|
|
265
269
|
const attachScopeMap = attachScopeResult.map ?? assertedPreprocessMap;
|
|
266
|
-
const
|
|
267
|
-
|
|
270
|
+
const sameVirtualSource = (source) => {
|
|
271
|
+
let resolved = source.startsWith("file://") ? nodeUrl.fileURLToPath(source) : source;
|
|
272
|
+
if (!nodePath.isAbsolute(resolved)) {
|
|
273
|
+
const candidates = [
|
|
274
|
+
nodePath.resolve(nodePath.dirname(virtualFileName), resolved),
|
|
275
|
+
nodePath.resolve(resolved)
|
|
276
|
+
];
|
|
277
|
+
return candidates.some(
|
|
278
|
+
(candidate) => nodePath.normalize(candidate) === nodePath.normalize(virtualFileName)
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
return nodePath.normalize(resolved) === nodePath.normalize(virtualFileName);
|
|
268
282
|
};
|
|
269
|
-
|
|
270
|
-
|
|
283
|
+
attachScopeMap?.sources.forEach((source, index2) => {
|
|
284
|
+
if (sameVirtualSource(source)) {
|
|
285
|
+
phantomIndices.push(index2);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
271
288
|
const offsetMappings = encode(
|
|
272
289
|
offsetSourceMap(
|
|
290
|
+
phantomIndices,
|
|
273
291
|
attachScopeResult.mappings,
|
|
274
|
-
currentSourceIndex,
|
|
275
292
|
styleDescriptor.loc.start.line - 1,
|
|
276
293
|
styleDescriptor.loc.start.column - 1
|
|
277
294
|
)
|
|
@@ -285,7 +302,7 @@ Caused by: "${fileId}".`;
|
|
|
285
302
|
attachScopeResult.error.loc.line,
|
|
286
303
|
attachScopeResult.error.loc.column
|
|
287
304
|
);
|
|
288
|
-
if (preprocessedPosition.source && !
|
|
305
|
+
if (preprocessedPosition.source && !sameVirtualSource(preprocessedPosition.source)) {
|
|
289
306
|
this.error({
|
|
290
307
|
message: attachScopeResult.error.message,
|
|
291
308
|
loc: {
|
|
@@ -316,20 +333,17 @@ Caused by: "${fileId}".`;
|
|
|
316
333
|
version: 3,
|
|
317
334
|
mappings: offsetMappings,
|
|
318
335
|
names: attachScopeMap?.names || assertedPreprocessMap?.names || [],
|
|
319
|
-
sources: attachScopeMap?.sources
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
return sourcesContent;
|
|
332
|
-
})() : void 0
|
|
336
|
+
sources: attachScopeMap?.sources.map((source, index2) => {
|
|
337
|
+
return phantomIndices.includes(index2) ? fileId : source;
|
|
338
|
+
}) ?? [
|
|
339
|
+
...assertedPreprocessMap?.sources.filter((source) => {
|
|
340
|
+
return !sameVirtualSource(source);
|
|
341
|
+
}) ?? [],
|
|
342
|
+
fileId
|
|
343
|
+
],
|
|
344
|
+
sourcesContent: attachScopeMap?.sourcesContent?.map((content, index2) => {
|
|
345
|
+
return phantomIndices.includes(index2) ? nodeFs.readFileSync(fileId, "utf-8") : content;
|
|
346
|
+
})
|
|
333
347
|
}
|
|
334
348
|
};
|
|
335
349
|
},
|
|
@@ -373,14 +387,14 @@ Caused by: "${fileId}".`;
|
|
|
373
387
|
}
|
|
374
388
|
const transformWithOxc = vite.transformWithOxc;
|
|
375
389
|
const transformWithEsbuild = vite.transformWithEsbuild;
|
|
376
|
-
const
|
|
390
|
+
const tsTransform = transformWithOxc ?? transformWithEsbuild;
|
|
391
|
+
const tsCompileRes = await tsTransform(
|
|
377
392
|
compiledCode,
|
|
378
393
|
id,
|
|
379
394
|
{
|
|
380
395
|
sourcemap,
|
|
381
|
-
|
|
382
|
-
loader: "ts"
|
|
383
|
-
target: "esnext"
|
|
396
|
+
target: "esnext",
|
|
397
|
+
[transformWithOxc ? "lang" : "loader"]: "ts"
|
|
384
398
|
},
|
|
385
399
|
sourcemap ? {
|
|
386
400
|
version: 3,
|
|
@@ -408,9 +422,17 @@ Caused by: "${fileId}".`;
|
|
|
408
422
|
};
|
|
409
423
|
} catch (err) {
|
|
410
424
|
if (isCompileError(err)) {
|
|
411
|
-
|
|
425
|
+
const location = new LinesAndColumns(src).locationForIndex(err.loc.start.index) || void 0;
|
|
426
|
+
this.error({
|
|
427
|
+
loc: location && {
|
|
428
|
+
file: id,
|
|
429
|
+
line: location.line + 1,
|
|
430
|
+
column: location.column
|
|
431
|
+
},
|
|
432
|
+
message: err.message
|
|
433
|
+
});
|
|
412
434
|
} else if (err.cause && isNumber(err.cause.pos)) {
|
|
413
|
-
this.error(
|
|
435
|
+
this.error({ message: err.message });
|
|
414
436
|
} else {
|
|
415
437
|
this.error(
|
|
416
438
|
"Qingkuai compile result is invalid. Please report this at https://github.com/qingkuai-js/qingkuai/issues and include your .qk source for reproduction."
|
|
@@ -474,7 +496,8 @@ Caused by: "${fileId}".`;
|
|
|
474
496
|
const qingkuaiConfig = getQingkuaiConfiguration(id);
|
|
475
497
|
const ret = {
|
|
476
498
|
interpretiveComments: isUndefined(qingkuaiConfig.interpretiveComments) ? isDev : !!qingkuaiConfig.interpretiveComments,
|
|
477
|
-
|
|
499
|
+
allowConstReactive: qingkuaiConfig.allowConstReactive !== false,
|
|
500
|
+
requireReactivityMark: qingkuaiConfig.requireReactivityMark === true,
|
|
478
501
|
reactivityMode: qingkuaiConfig.reactivityMode === "shallow" ? "shallow" : "reactive"
|
|
479
502
|
};
|
|
480
503
|
switch (qingkuaiConfig.whitespace) {
|
|
@@ -491,7 +514,7 @@ Caused by: "${fileId}".`;
|
|
|
491
514
|
}
|
|
492
515
|
}
|
|
493
516
|
switch (qingkuaiConfig.preserveHtmlComments) {
|
|
494
|
-
case "
|
|
517
|
+
case "always": {
|
|
495
518
|
ret.preserveHtmlComments = true;
|
|
496
519
|
break;
|
|
497
520
|
}
|
package/package.json
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
"author": "mlgq",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.27",
|
|
7
7
|
"packageManager": "pnpm@9.9.0",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.js",
|
|
11
12
|
"require": "./dist/index.cjs"
|
|
12
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
13
15
|
},
|
|
14
16
|
"repository": {
|
|
15
17
|
"type": "git",
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
"fs-extra": "^11.3.0",
|
|
31
33
|
"husky": "^9.1.7",
|
|
32
34
|
"lint-staged": "^17.3.0",
|
|
33
|
-
"qingkuai": "^1.0.
|
|
35
|
+
"qingkuai": "^1.0.101",
|
|
34
36
|
"rimraf": "^6.0.1",
|
|
35
37
|
"rollup": "^4.38.0",
|
|
36
38
|
"rollup-plugin-dts": "^6.2.1",
|