@sigx/vite 0.1.2 → 0.1.4
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/LICENSE +21 -0
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +8 -20
- package/dist/hmr.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +47 -48
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Andreas Ekdahl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/hmr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAIxD;AAcD;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CA0DvC"}
|
package/dist/hmr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// HMR runtime for sigx - runs in the browser
|
|
2
|
-
import { registerComponentPlugin
|
|
2
|
+
import { registerComponentPlugin } from 'sigx';
|
|
3
3
|
// Track instances by component ID (moduleId:index)
|
|
4
4
|
const instancesByComponentId = new Map();
|
|
5
5
|
// Track component definition order within each module
|
|
@@ -48,8 +48,9 @@ export function installHMRPlugin() {
|
|
|
48
48
|
try {
|
|
49
49
|
// Re-run the NEW setup with the existing context to get new render fn
|
|
50
50
|
const newRenderFn = setup(instance.ctx);
|
|
51
|
-
//
|
|
52
|
-
instance.
|
|
51
|
+
// Set the new render function and trigger re-render (Vue-style)
|
|
52
|
+
instance.ctx.renderFn = newRenderFn;
|
|
53
|
+
instance.ctx.update();
|
|
53
54
|
}
|
|
54
55
|
catch (e) {
|
|
55
56
|
console.error(`[sigx] HMR failed for ${name || 'component'}:`, e);
|
|
@@ -60,14 +61,8 @@ export function installHMRPlugin() {
|
|
|
60
61
|
const originalSetup = setup;
|
|
61
62
|
factory.__setup = (ctx) => {
|
|
62
63
|
// Run the original setup
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
// When this changes, the effect that reads it will re-run
|
|
66
|
-
const renderFnSignal = signal({ fn: currentRenderFn });
|
|
67
|
-
const instance = {
|
|
68
|
-
ctx,
|
|
69
|
-
renderFnSignal
|
|
70
|
-
};
|
|
64
|
+
const renderFn = originalSetup(ctx);
|
|
65
|
+
const instance = { ctx };
|
|
71
66
|
// Register instance by component ID
|
|
72
67
|
let instances = instancesByComponentId.get(componentId);
|
|
73
68
|
if (!instances) {
|
|
@@ -81,15 +76,8 @@ export function installHMRPlugin() {
|
|
|
81
76
|
if (instances)
|
|
82
77
|
instances.delete(instance);
|
|
83
78
|
});
|
|
84
|
-
// Return
|
|
85
|
-
|
|
86
|
-
return () => {
|
|
87
|
-
const fn = renderFnSignal.fn;
|
|
88
|
-
if (typeof fn === 'function') {
|
|
89
|
-
return fn();
|
|
90
|
-
}
|
|
91
|
-
return undefined;
|
|
92
|
-
};
|
|
79
|
+
// Return the render function as-is
|
|
80
|
+
return renderFn;
|
|
93
81
|
};
|
|
94
82
|
}
|
|
95
83
|
});
|
package/dist/hmr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.js","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"hmr.js","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,uBAAuB,EAA8B,MAAM,MAAM,CAAC;AAM3E,mDAAmD;AACnD,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAA8B,CAAC;AAErE,sDAAsD;AACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEvD,kCAAkC;AAClC,IAAI,eAAe,GAAkB,IAAI,CAAC;AAE1C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAC9C,eAAe,GAAG,QAAQ,CAAC;IAC3B,0EAA0E;IAC1E,oBAAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB;IACvB,IAAI,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAElC,MAAM,KAAK,GAAG,oBAAoB,CAAC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BAC7C,yBAAyB;gBACzB,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;gBAEpC,MAAM,QAAQ,GAAkB,EAAE,GAAG,EAAE,CAAC;gBAExC,oCAAoC;gBACpC,IAAI,SAAS,GAAG,sBAAsB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACxD,IAAI,CAAC,SAAS,EAAE,CAAC;oBACb,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;oBACtB,sBAAsB,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;gBACvD,CAAC;gBACD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAExB,qBAAqB;gBACrB,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;oBACf,MAAM,SAAS,GAAG,sBAAsB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;oBAC1D,IAAI,SAAS;wBAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC;gBAEH,mCAAmC;gBACnC,OAAO,QAAQ,CAAC;YACpB,CAAC,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;AACP,CAAC;AAED,0CAA0C;AAC1C,gBAAgB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,12 +11,12 @@ export function sigxPlugin(options = {}) {
|
|
|
11
11
|
config = resolvedConfig;
|
|
12
12
|
},
|
|
13
13
|
transform(code, id) {
|
|
14
|
-
// Only process
|
|
15
|
-
if (!/\.(
|
|
14
|
+
// Only process TypeScript/TSX source files (not pre-built JS)
|
|
15
|
+
if (!/\.tsx?$/.test(id) && !/\.jsx$/.test(id)) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
// Skip node_modules
|
|
19
|
-
if (id.includes('node_modules')) {
|
|
18
|
+
// Skip node_modules and dist folders
|
|
19
|
+
if (id.includes('node_modules') || id.includes('/dist/') || id.includes('\\dist\\')) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
// Check if this file contains defineComponent
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,UAAU,UAAU,CAAC,UAA6B,EAAE;IACtD,MAAM,EACF,GAAG,GAAG,IAAI,GACb,GAAG,OAAO,CAAC;IAEZ,IAAI,MAAsB,CAAC;IAE3B,OAAO;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,KAAK;QAEd,cAAc,CAAC,cAAc;YACzB,MAAM,GAAG,cAAc,CAAC;QAC5B,CAAC;QAED,SAAS,CAAC,IAAI,EAAE,EAAE;YACd,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,UAAU,UAAU,CAAC,UAA6B,EAAE;IACtD,MAAM,EACF,GAAG,GAAG,IAAI,GACb,GAAG,OAAO,CAAC;IAEZ,IAAI,MAAsB,CAAC;IAE3B,OAAO;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,KAAK;QAEd,cAAc,CAAC,cAAc;YACzB,MAAM,GAAG,cAAc,CAAC;QAC5B,CAAC;QAED,SAAS,CAAC,IAAI,EAAE,EAAE;YACd,8DAA8D;YAC9D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,qCAAqC;YACrC,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBA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-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@sigx/vite",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Vite plugin for SignalX Framework with HMR and automatic type generation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./hmr": {
|
|
14
|
+
"import": "./dist/hmr.js",
|
|
15
|
+
"types": "./dist/hmr.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"sigx": "*",
|
|
23
|
+
"vite": ">=5.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.19.1",
|
|
27
|
+
"vite": "^7.2.4"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"SignalX"
|
|
31
|
+
],
|
|
32
|
+
"author": "Andreas Ekdahl",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/signalxjs/core.git",
|
|
37
|
+
"directory": "packages/vite"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/signalxjs",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/signalxjs/core/issues"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc",
|
|
45
|
+
"dev": "tsc --watch"
|
|
46
|
+
}
|
|
47
|
+
}
|