nexa-vite-plugin 0.1.2 → 0.2.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/plugin.d.ts.map +1 -1
- package/dist/plugin.js +12 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,IAAI,GAAG,CAmEhC"}
|
package/dist/plugin.js
CHANGED
|
@@ -7,16 +7,27 @@ export function nexaPlugin() {
|
|
|
7
7
|
transform(code, id) {
|
|
8
8
|
if (!id.endsWith(nexaExt))
|
|
9
9
|
return null;
|
|
10
|
+
const hmrId = id.split('?')[0].split('/').pop()?.replace(/\./g, '_') || 'comp';
|
|
10
11
|
try {
|
|
11
12
|
const sfc = parseSFC(code);
|
|
12
13
|
const scriptContent = sfc.script?.content || '';
|
|
13
14
|
const templateContent = sfc.template?.content || null;
|
|
14
|
-
|
|
15
|
+
let compiled = generateComponentCode({
|
|
15
16
|
template: templateContent,
|
|
16
17
|
script: scriptContent,
|
|
17
18
|
style: sfc.styles[0]?.content || null,
|
|
18
19
|
scoped: sfc.styles[0]?.scoped || false,
|
|
20
|
+
hmrId: hmrId,
|
|
19
21
|
});
|
|
22
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
23
|
+
compiled += `\n\n/* HMR */`;
|
|
24
|
+
compiled += `\nif (import.meta.hot) {`;
|
|
25
|
+
compiled += `\n registerComponent('${hmrId}', _sfc_main)`;
|
|
26
|
+
compiled += `\n import.meta.hot.accept((mod) => {`;
|
|
27
|
+
compiled += `\n reloadComponent('${hmrId}', mod.default)`;
|
|
28
|
+
compiled += `\n })`;
|
|
29
|
+
compiled += `\n}`;
|
|
30
|
+
}
|
|
20
31
|
return {
|
|
21
32
|
code: compiled,
|
|
22
33
|
map: null,
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE/D,MAAM,OAAO,GAAG,OAAO,CAAA;AAEvB,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,KAAc;QAEvB,SAAS,CAAC,IAAY,EAAE,EAAU;YAChC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAAE,OAAO,IAAI,CAAA;YAEtC,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;gBAC1B,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAA;gBAC/C,MAAM,eAAe,GAAG,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,IAAI,CAAA;gBAErD,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE/D,MAAM,OAAO,GAAG,OAAO,CAAA;AAEvB,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,KAAc;QAEvB,SAAS,CAAC,IAAY,EAAE,EAAU;YAChC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAAE,OAAO,IAAI,CAAA;YAEtC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CA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AAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,OAAO,EAAE,CAAC,CAAA;gBACtD,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;QAED,eAAe,CAAC,GAAQ;YACtB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAE5B,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;gBACrD,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;gBAC7C,CAAC;gBAED,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,CAAC;4BACR,IAAI,EAAE,WAAW;4BACjB,IAAI,EAAE,IAAI;4BACV,YAAY,EAAE,IAAI;4BAClB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;yBACtB,CAAC;iBACH,CAAC,CAAA;gBAEF,OAAO,EAAE,CAAA;YACX,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexa-vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"nexa-compiler": "0.
|
|
16
|
+
"nexa-compiler": "0.2.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"vite": "^5.0.0 || ^6.0.0"
|