@vizejs/unplugin 0.428.1 → 0.429.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/babel.cjs +1 -1
- package/dist/babel.mjs +1 -1
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rolldown.cjs +1 -1
- package/dist/rolldown.mjs +1 -1
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.mjs +1 -1
- package/dist/{unplugin-CVX51sBt.cjs → unplugin-BZZSLylM.cjs} +69 -2
- package/dist/{unplugin-CreP_VP8.mjs → unplugin-LGSCePN4.mjs} +69 -2
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +2 -2
package/dist/babel.cjs
CHANGED
package/dist/babel.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createFilter, i as generateOutput, r as compileVueModule, t as normalizeOptions } from "./unplugin-
|
|
1
|
+
import { a as createFilter, i as generateOutput, r as compileVueModule, t as normalizeOptions } from "./unplugin-LGSCePN4.mjs";
|
|
2
2
|
//#region src/babel.ts
|
|
3
3
|
function vizeBabelPlugin(_api, rawOptions = {}) {
|
|
4
4
|
const options = normalizeOptions(rawOptions);
|
package/dist/esbuild.cjs
CHANGED
package/dist/esbuild.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_unplugin = require("./unplugin-
|
|
5
|
+
const require_unplugin = require("./unplugin-BZZSLylM.cjs");
|
|
6
6
|
exports.default = require_unplugin.vizeUnplugin;
|
|
7
7
|
exports.vizeUnplugin = require_unplugin.vizeUnplugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as vizeUnplugin } from "./unplugin-
|
|
1
|
+
import { n as vizeUnplugin } from "./unplugin-LGSCePN4.mjs";
|
|
2
2
|
export { vizeUnplugin as default, vizeUnplugin };
|
package/dist/rolldown.cjs
CHANGED
package/dist/rolldown.mjs
CHANGED
package/dist/rollup.cjs
CHANGED
package/dist/rollup.mjs
CHANGED
|
@@ -46,6 +46,74 @@ function matchesPattern(pattern, id) {
|
|
|
46
46
|
return matches;
|
|
47
47
|
}
|
|
48
48
|
//#endregion
|
|
49
|
+
//#region ../shared/source-map.ts
|
|
50
|
+
function isSourceMapV3(value) {
|
|
51
|
+
if (value === null || typeof value !== "object") return false;
|
|
52
|
+
const map = value;
|
|
53
|
+
return map.version === 3 && Array.isArray(map.sources) && Array.isArray(map.names) && typeof map.mappings === "string";
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse a compiler-produced map, or `null` when there is nothing usable.
|
|
57
|
+
*
|
|
58
|
+
* A malformed map is worse than no map — Vite would chain garbage into the
|
|
59
|
+
* bundle's map — so anything that is not a v3 document is dropped.
|
|
60
|
+
*/
|
|
61
|
+
function parseSourceMap(json) {
|
|
62
|
+
if (!json) return null;
|
|
63
|
+
let parsed;
|
|
64
|
+
try {
|
|
65
|
+
parsed = JSON.parse(json);
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return isSourceMapV3(parsed) ? parsed : null;
|
|
70
|
+
}
|
|
71
|
+
function countNewlines(text) {
|
|
72
|
+
let total = 0;
|
|
73
|
+
for (let index = text.indexOf("\n"); index !== -1; index = text.indexOf("\n", index + 1)) total++;
|
|
74
|
+
return total;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Insert `count` unmapped generated lines at generated line `atLine`.
|
|
78
|
+
*
|
|
79
|
+
* Returns the map unchanged when the insertion lands past the last mapped line,
|
|
80
|
+
* because nothing after it needs moving.
|
|
81
|
+
*/
|
|
82
|
+
function shiftMappedLines(map, atLine, count) {
|
|
83
|
+
if (count <= 0) return map;
|
|
84
|
+
const groups = map.mappings.split(";");
|
|
85
|
+
if (atLine >= groups.length) return map;
|
|
86
|
+
const shifted = [
|
|
87
|
+
...groups.slice(0, atLine),
|
|
88
|
+
...Array(count).fill(""),
|
|
89
|
+
...groups.slice(atLine)
|
|
90
|
+
];
|
|
91
|
+
return {
|
|
92
|
+
...map,
|
|
93
|
+
mappings: shifted.join(";")
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Prefix a native JSX module with unmapped generated whole lines.
|
|
97
|
+
* The actual style injection supplies the prefix; authored UTF-16 columns are
|
|
98
|
+
* unchanged because the module resumes at column zero on a new generated line.
|
|
99
|
+
*/
|
|
100
|
+
function prependMappedJsxCode(code, mapJson, prefix) {
|
|
101
|
+
const output = prefix + code;
|
|
102
|
+
if (!prefix) return {
|
|
103
|
+
code: output,
|
|
104
|
+
map: mapJson ?? null
|
|
105
|
+
};
|
|
106
|
+
const map = parseSourceMap(mapJson);
|
|
107
|
+
if (!map || !prefix.endsWith("\n")) return {
|
|
108
|
+
code: output,
|
|
109
|
+
map: null
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
code: output,
|
|
113
|
+
map: JSON.stringify(shiftMappedLines(map, 0, countNewlines(prefix)))
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
49
117
|
//#region src/style.ts
|
|
50
118
|
const PREPROCESSOR_LANGS = new Set([
|
|
51
119
|
"scss",
|
|
@@ -254,8 +322,7 @@ function compileJsxModule(filePath, source, options) {
|
|
|
254
322
|
let map = result.map ?? null;
|
|
255
323
|
if (css) {
|
|
256
324
|
const styleKey = result.scopedStyles[0].scopeId.replace(/^data-v-/, "");
|
|
257
|
-
code =
|
|
258
|
-
map = null;
|
|
325
|
+
({code, map} = prependMappedJsxCode(code, map, prependInlineStyleInjection("", css, styleKey)));
|
|
259
326
|
}
|
|
260
327
|
return {
|
|
261
328
|
code,
|
|
@@ -23,6 +23,74 @@ function matchesPattern(pattern, id) {
|
|
|
23
23
|
return matches;
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
|
+
//#region ../shared/source-map.ts
|
|
27
|
+
function isSourceMapV3(value) {
|
|
28
|
+
if (value === null || typeof value !== "object") return false;
|
|
29
|
+
const map = value;
|
|
30
|
+
return map.version === 3 && Array.isArray(map.sources) && Array.isArray(map.names) && typeof map.mappings === "string";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse a compiler-produced map, or `null` when there is nothing usable.
|
|
34
|
+
*
|
|
35
|
+
* A malformed map is worse than no map — Vite would chain garbage into the
|
|
36
|
+
* bundle's map — so anything that is not a v3 document is dropped.
|
|
37
|
+
*/
|
|
38
|
+
function parseSourceMap(json) {
|
|
39
|
+
if (!json) return null;
|
|
40
|
+
let parsed;
|
|
41
|
+
try {
|
|
42
|
+
parsed = JSON.parse(json);
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return isSourceMapV3(parsed) ? parsed : null;
|
|
47
|
+
}
|
|
48
|
+
function countNewlines(text) {
|
|
49
|
+
let total = 0;
|
|
50
|
+
for (let index = text.indexOf("\n"); index !== -1; index = text.indexOf("\n", index + 1)) total++;
|
|
51
|
+
return total;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Insert `count` unmapped generated lines at generated line `atLine`.
|
|
55
|
+
*
|
|
56
|
+
* Returns the map unchanged when the insertion lands past the last mapped line,
|
|
57
|
+
* because nothing after it needs moving.
|
|
58
|
+
*/
|
|
59
|
+
function shiftMappedLines(map, atLine, count) {
|
|
60
|
+
if (count <= 0) return map;
|
|
61
|
+
const groups = map.mappings.split(";");
|
|
62
|
+
if (atLine >= groups.length) return map;
|
|
63
|
+
const shifted = [
|
|
64
|
+
...groups.slice(0, atLine),
|
|
65
|
+
...Array(count).fill(""),
|
|
66
|
+
...groups.slice(atLine)
|
|
67
|
+
];
|
|
68
|
+
return {
|
|
69
|
+
...map,
|
|
70
|
+
mappings: shifted.join(";")
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Prefix a native JSX module with unmapped generated whole lines.
|
|
74
|
+
* The actual style injection supplies the prefix; authored UTF-16 columns are
|
|
75
|
+
* unchanged because the module resumes at column zero on a new generated line.
|
|
76
|
+
*/
|
|
77
|
+
function prependMappedJsxCode(code, mapJson, prefix) {
|
|
78
|
+
const output = prefix + code;
|
|
79
|
+
if (!prefix) return {
|
|
80
|
+
code: output,
|
|
81
|
+
map: mapJson ?? null
|
|
82
|
+
};
|
|
83
|
+
const map = parseSourceMap(mapJson);
|
|
84
|
+
if (!map || !prefix.endsWith("\n")) return {
|
|
85
|
+
code: output,
|
|
86
|
+
map: null
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
code: output,
|
|
90
|
+
map: JSON.stringify(shiftMappedLines(map, 0, countNewlines(prefix)))
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
26
94
|
//#region src/style.ts
|
|
27
95
|
const PREPROCESSOR_LANGS = new Set([
|
|
28
96
|
"scss",
|
|
@@ -231,8 +299,7 @@ function compileJsxModule(filePath, source, options) {
|
|
|
231
299
|
let map = result.map ?? null;
|
|
232
300
|
if (css) {
|
|
233
301
|
const styleKey = result.scopedStyles[0].scopeId.replace(/^data-v-/, "");
|
|
234
|
-
code =
|
|
235
|
-
map = null;
|
|
302
|
+
({code, map} = prependMappedJsxCode(code, map, prependInlineStyleInjection("", css, styleKey)));
|
|
236
303
|
}
|
|
237
304
|
return {
|
|
238
305
|
code,
|
package/dist/webpack.cjs
CHANGED
package/dist/webpack.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/unplugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.429.0",
|
|
4
4
|
"description": "Experimental Vue SFC integrations for Rollup, Rolldown, Webpack, esbuild, and Babel powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"babel",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@vizejs/native": "0.
|
|
71
|
+
"@vizejs/native": "0.429.0",
|
|
72
72
|
"oxc-transform": "0.144.0",
|
|
73
73
|
"unplugin": "3.3.0"
|
|
74
74
|
},
|