vite-plugin-qingkuai 1.0.26 → 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 +21 -12
- package/dist/index.js +21 -12
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -78,11 +78,11 @@ async function attachScopeForStyleSelectors(code, hash, sourceFile, map) {
|
|
|
78
78
|
}
|
|
79
79
|
]);
|
|
80
80
|
const ret = await processor.process(code, {
|
|
81
|
-
from: sourceFile,
|
|
82
81
|
map: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
82
|
+
annotation: false,
|
|
83
|
+
prev: map?.version ? map : void 0
|
|
84
|
+
},
|
|
85
|
+
from: sourceFile
|
|
86
86
|
});
|
|
87
87
|
const outputMap = ret.map?.toJSON();
|
|
88
88
|
return {
|
|
@@ -408,14 +408,14 @@ Caused by: "${fileId}".`;
|
|
|
408
408
|
}
|
|
409
409
|
const transformWithOxc = vite__namespace.transformWithOxc;
|
|
410
410
|
const transformWithEsbuild = vite__namespace.transformWithEsbuild;
|
|
411
|
-
const
|
|
411
|
+
const tsTransform = transformWithOxc ?? transformWithEsbuild;
|
|
412
|
+
const tsCompileRes = await tsTransform(
|
|
412
413
|
compiledCode,
|
|
413
414
|
id,
|
|
414
415
|
{
|
|
415
416
|
sourcemap,
|
|
416
|
-
|
|
417
|
-
loader: "ts"
|
|
418
|
-
target: "esnext"
|
|
417
|
+
target: "esnext",
|
|
418
|
+
[transformWithOxc ? "lang" : "loader"]: "ts"
|
|
419
419
|
},
|
|
420
420
|
sourcemap ? {
|
|
421
421
|
version: 3,
|
|
@@ -443,9 +443,17 @@ Caused by: "${fileId}".`;
|
|
|
443
443
|
};
|
|
444
444
|
} catch (err) {
|
|
445
445
|
if (compiler.isCompileError(err)) {
|
|
446
|
-
|
|
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
|
+
});
|
|
447
455
|
} else if (err.cause && isNumber(err.cause.pos)) {
|
|
448
|
-
this.error(
|
|
456
|
+
this.error({ message: err.message });
|
|
449
457
|
} else {
|
|
450
458
|
this.error(
|
|
451
459
|
"Qingkuai compile result is invalid. Please report this at https://github.com/qingkuai-js/qingkuai/issues and include your .qk source for reproduction."
|
|
@@ -509,7 +517,8 @@ Caused by: "${fileId}".`;
|
|
|
509
517
|
const qingkuaiConfig = getQingkuaiConfiguration(id);
|
|
510
518
|
const ret = {
|
|
511
519
|
interpretiveComments: isUndefined(qingkuaiConfig.interpretiveComments) ? isDev : !!qingkuaiConfig.interpretiveComments,
|
|
512
|
-
|
|
520
|
+
allowConstReactive: qingkuaiConfig.allowConstReactive !== false,
|
|
521
|
+
requireReactivityMark: qingkuaiConfig.requireReactivityMark === true,
|
|
513
522
|
reactivityMode: qingkuaiConfig.reactivityMode === "shallow" ? "shallow" : "reactive"
|
|
514
523
|
};
|
|
515
524
|
switch (qingkuaiConfig.whitespace) {
|
|
@@ -526,7 +535,7 @@ Caused by: "${fileId}".`;
|
|
|
526
535
|
}
|
|
527
536
|
}
|
|
528
537
|
switch (qingkuaiConfig.preserveHtmlComments) {
|
|
529
|
-
case "
|
|
538
|
+
case "always": {
|
|
530
539
|
ret.preserveHtmlComments = true;
|
|
531
540
|
break;
|
|
532
541
|
}
|
package/dist/index.js
CHANGED
|
@@ -57,11 +57,11 @@ async function attachScopeForStyleSelectors(code, hash, sourceFile, map) {
|
|
|
57
57
|
}
|
|
58
58
|
]);
|
|
59
59
|
const ret = await processor.process(code, {
|
|
60
|
-
from: sourceFile,
|
|
61
60
|
map: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
61
|
+
annotation: false,
|
|
62
|
+
prev: map?.version ? map : void 0
|
|
63
|
+
},
|
|
64
|
+
from: sourceFile
|
|
65
65
|
});
|
|
66
66
|
const outputMap = ret.map?.toJSON();
|
|
67
67
|
return {
|
|
@@ -387,14 +387,14 @@ Caused by: "${fileId}".`;
|
|
|
387
387
|
}
|
|
388
388
|
const transformWithOxc = vite.transformWithOxc;
|
|
389
389
|
const transformWithEsbuild = vite.transformWithEsbuild;
|
|
390
|
-
const
|
|
390
|
+
const tsTransform = transformWithOxc ?? transformWithEsbuild;
|
|
391
|
+
const tsCompileRes = await tsTransform(
|
|
391
392
|
compiledCode,
|
|
392
393
|
id,
|
|
393
394
|
{
|
|
394
395
|
sourcemap,
|
|
395
|
-
|
|
396
|
-
loader: "ts"
|
|
397
|
-
target: "esnext"
|
|
396
|
+
target: "esnext",
|
|
397
|
+
[transformWithOxc ? "lang" : "loader"]: "ts"
|
|
398
398
|
},
|
|
399
399
|
sourcemap ? {
|
|
400
400
|
version: 3,
|
|
@@ -422,9 +422,17 @@ Caused by: "${fileId}".`;
|
|
|
422
422
|
};
|
|
423
423
|
} catch (err) {
|
|
424
424
|
if (isCompileError(err)) {
|
|
425
|
-
|
|
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
|
+
});
|
|
426
434
|
} else if (err.cause && isNumber(err.cause.pos)) {
|
|
427
|
-
this.error(
|
|
435
|
+
this.error({ message: err.message });
|
|
428
436
|
} else {
|
|
429
437
|
this.error(
|
|
430
438
|
"Qingkuai compile result is invalid. Please report this at https://github.com/qingkuai-js/qingkuai/issues and include your .qk source for reproduction."
|
|
@@ -488,7 +496,8 @@ Caused by: "${fileId}".`;
|
|
|
488
496
|
const qingkuaiConfig = getQingkuaiConfiguration(id);
|
|
489
497
|
const ret = {
|
|
490
498
|
interpretiveComments: isUndefined(qingkuaiConfig.interpretiveComments) ? isDev : !!qingkuaiConfig.interpretiveComments,
|
|
491
|
-
|
|
499
|
+
allowConstReactive: qingkuaiConfig.allowConstReactive !== false,
|
|
500
|
+
requireReactivityMark: qingkuaiConfig.requireReactivityMark === true,
|
|
492
501
|
reactivityMode: qingkuaiConfig.reactivityMode === "shallow" ? "shallow" : "reactive"
|
|
493
502
|
};
|
|
494
503
|
switch (qingkuaiConfig.whitespace) {
|
|
@@ -505,7 +514,7 @@ Caused by: "${fileId}".`;
|
|
|
505
514
|
}
|
|
506
515
|
}
|
|
507
516
|
switch (qingkuaiConfig.preserveHtmlComments) {
|
|
508
|
-
case "
|
|
517
|
+
case "always": {
|
|
509
518
|
ret.preserveHtmlComments = true;
|
|
510
519
|
break;
|
|
511
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",
|