@vizejs/vite-plugin 0.11.0 → 0.13.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.
- package/dist/index.d.ts +16 -3
- package/dist/index.js +25 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -498,7 +498,11 @@ interface CompiledModule {
|
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
//#endregion
|
|
501
|
-
//#region src/
|
|
501
|
+
//#region src/plugin.d.ts
|
|
502
|
+
declare function vize(options?: VizeOptions): Plugin[];
|
|
503
|
+
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/config.d.ts
|
|
502
506
|
/**
|
|
503
507
|
* Define a Vize configuration with type checking.
|
|
504
508
|
* Accepts a plain object or a function that receives ConfigEnv.
|
|
@@ -514,15 +518,24 @@ declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<
|
|
|
514
518
|
* Used by musea() and other plugins to access the unified config.
|
|
515
519
|
*/
|
|
516
520
|
declare const vizeConfigStore: Map<string, VizeConfig>;
|
|
521
|
+
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/virtual.d.ts
|
|
517
524
|
interface DynamicImportAliasRule {
|
|
518
525
|
fromPrefix: string;
|
|
519
526
|
toPrefix: string;
|
|
520
527
|
}
|
|
528
|
+
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/transform.d.ts
|
|
531
|
+
/** Check if a module ID is a vize-compiled virtual module */
|
|
521
532
|
declare function rewriteStaticAssetUrls(code: string, aliasRules: DynamicImportAliasRule[]): string;
|
|
533
|
+
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/index.d.ts
|
|
522
536
|
declare const __internal: {
|
|
523
537
|
rewriteStaticAssetUrls: typeof rewriteStaticAssetUrls;
|
|
524
538
|
};
|
|
525
|
-
declare function vize(options?: VizeOptions): Plugin[];
|
|
526
539
|
|
|
527
540
|
//#endregion
|
|
528
|
-
export { CompiledModule, LoadConfigOptions, VizeConfig, VizeOptions, __internal, vize as default, defineConfig, loadConfig, vize, vizeConfigStore };
|
|
541
|
+
export { CompiledModule, LoadConfigOptions, VizeConfig, VizeOptions, __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, vize as default, defineConfig, loadConfig, vize, vizeConfigStore };
|
package/dist/index.js
CHANGED
|
@@ -336,7 +336,7 @@ function compileBatch(files, cache, options) {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
//#endregion
|
|
339
|
-
//#region src/
|
|
339
|
+
//#region src/config.ts
|
|
340
340
|
const CONFIG_FILES = [
|
|
341
341
|
"vize.config.ts",
|
|
342
342
|
"vize.config.js",
|
|
@@ -411,6 +411,9 @@ async function loadConfigFile(configPath, env) {
|
|
|
411
411
|
* Used by musea() and other plugins to access the unified config.
|
|
412
412
|
*/
|
|
413
413
|
const vizeConfigStore = new Map();
|
|
414
|
+
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/virtual.ts
|
|
414
417
|
const LEGACY_VIZE_PREFIX = "\0vize:";
|
|
415
418
|
const VIRTUAL_CSS_MODULE = "virtual:vize-styles";
|
|
416
419
|
const RESOLVED_CSS_MODULE = "\0vize:all-styles.css";
|
|
@@ -450,6 +453,9 @@ function rewriteDynamicTemplateImports(code, aliasRules) {
|
|
|
450
453
|
rewritten = rewritten.replace(/\bimport\s*\(\s*`/g, "import(/* @vite-ignore */ `");
|
|
451
454
|
return rewritten;
|
|
452
455
|
}
|
|
456
|
+
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/transform.ts
|
|
453
459
|
/**
|
|
454
460
|
* Rewrite static asset URLs in compiled template output.
|
|
455
461
|
*
|
|
@@ -475,15 +481,6 @@ function rewriteStaticAssetUrls(code, aliasRules) {
|
|
|
475
481
|
if (imports.length > 0) rewritten = imports.join("\n") + "\n" + rewritten;
|
|
476
482
|
return rewritten;
|
|
477
483
|
}
|
|
478
|
-
const __internal = { rewriteStaticAssetUrls };
|
|
479
|
-
function createLogger(debug) {
|
|
480
|
-
return {
|
|
481
|
-
log: (...args) => debug && console.log("[vize]", ...args),
|
|
482
|
-
info: (...args) => console.log("[vize]", ...args),
|
|
483
|
-
warn: (...args) => console.warn("[vize]", ...args),
|
|
484
|
-
error: (...args) => console.error("[vize]", ...args)
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
484
|
/**
|
|
488
485
|
* Built-in Vite/Vue/Nuxt define keys that are handled by Vite's own transform pipeline.
|
|
489
486
|
* These must NOT be replaced by the vize plugin because:
|
|
@@ -522,6 +519,17 @@ function applyDefineReplacements(code, defines) {
|
|
|
522
519
|
}
|
|
523
520
|
return result;
|
|
524
521
|
}
|
|
522
|
+
function createLogger(debug) {
|
|
523
|
+
return {
|
|
524
|
+
log: (...args) => debug && console.log("[vize]", ...args),
|
|
525
|
+
info: (...args) => console.log("[vize]", ...args),
|
|
526
|
+
warn: (...args) => console.warn("[vize]", ...args),
|
|
527
|
+
error: (...args) => console.error("[vize]", ...args)
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/plugin.ts
|
|
525
533
|
function vize(options = {}) {
|
|
526
534
|
const cache = new Map();
|
|
527
535
|
const collectedCss = new Map();
|
|
@@ -688,7 +696,7 @@ function vize(options = {}) {
|
|
|
688
696
|
if (fsPath.startsWith("/") && fs.existsSync(fsPath) && fs.statSync(fsPath).isFile() && !fsPath.endsWith(".vue.ts")) {
|
|
689
697
|
const cleaned = queryPart ? `${cleanedPath}?${queryPart}` : cleanedPath;
|
|
690
698
|
if (cleaned !== req.url) {
|
|
691
|
-
logger.log(`middleware: rewriting ${req.url}
|
|
699
|
+
logger.log(`middleware: rewriting ${req.url} -> ${cleaned}`);
|
|
692
700
|
req.url = cleaned;
|
|
693
701
|
}
|
|
694
702
|
}
|
|
@@ -960,7 +968,7 @@ function vize(options = {}) {
|
|
|
960
968
|
const fsPath = pathPart.startsWith("/@fs/") ? pathPart.slice(4) : pathPart;
|
|
961
969
|
if (fsPath.startsWith("/") && fs.existsSync(fsPath) && fs.statSync(fsPath).isFile()) {
|
|
962
970
|
const importPath = server === null ? `${pathToFileURL(fsPath).href}${querySuffix}` : "/@fs" + fsPath + querySuffix;
|
|
963
|
-
logger.log(`load: proxying \0-prefixed file ${id}
|
|
971
|
+
logger.log(`load: proxying \0-prefixed file ${id} -> re-export from ${importPath}`);
|
|
964
972
|
return `export { default } from ${JSON.stringify(importPath)};\nexport * from ${JSON.stringify(importPath)};`;
|
|
965
973
|
}
|
|
966
974
|
}
|
|
@@ -1122,7 +1130,11 @@ function vize(options = {}) {
|
|
|
1122
1130
|
postTransformPlugin
|
|
1123
1131
|
];
|
|
1124
1132
|
}
|
|
1133
|
+
|
|
1134
|
+
//#endregion
|
|
1135
|
+
//#region src/index.ts
|
|
1136
|
+
const __internal = { rewriteStaticAssetUrls };
|
|
1125
1137
|
var src_default = vize;
|
|
1126
1138
|
|
|
1127
1139
|
//#endregion
|
|
1128
|
-
export { __internal, src_default as default, defineConfig, loadConfig, vize, vizeConfigStore };
|
|
1140
|
+
export { __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, src_default as default, defineConfig, loadConfig, vize, vizeConfigStore };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"tinyglobby": "^0.2.0",
|
|
46
|
-
"@vizejs/native": "0.
|
|
46
|
+
"@vizejs/native": "0.13.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsdown",
|