isotone 1.1.2 → 1.1.3
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/AGENTS.md +5 -1
- package/CHANGELOG.md +12 -0
- package/dist/chunk-BDTB3DFR.js +100 -0
- package/dist/chunk-BDTB3DFR.js.map +1 -0
- package/dist/{chunk-TGAU3WTF.js → chunk-BRBXIGZP.js} +56 -12
- package/dist/chunk-BRBXIGZP.js.map +1 -0
- package/dist/{chunk-FKEKBZ3E.js → chunk-K5RAC2BT.js} +94 -6
- package/dist/chunk-K5RAC2BT.js.map +1 -0
- package/dist/{chunk-X6V2AKJL.js → chunk-LXW6WFOC.js} +33 -6
- package/dist/chunk-LXW6WFOC.js.map +1 -0
- package/dist/{chunk-PUXQGUMQ.js → chunk-RKZWO37H.js} +20 -5
- package/dist/chunk-RKZWO37H.js.map +1 -0
- package/dist/{chunk-I7CZUPDO.js → chunk-YTEUMO3O.js} +2 -2
- package/dist/{chunk-I7CZUPDO.js.map → chunk-YTEUMO3O.js.map} +1 -1
- package/dist/cli.js +46 -7
- package/dist/cli.js.map +1 -1
- package/dist/core.d.ts +44 -9
- package/dist/core.js +4 -2
- package/dist/index.js +37 -29
- package/dist/index.js.map +1 -1
- package/dist/isotone.global.js +20 -20
- package/dist/serve.js +2 -2
- package/dist/server.js +3 -3
- package/dist/vite-plugin.js +29 -113
- package/dist/vite-plugin.js.map +1 -1
- package/docs/variants.md +37 -2
- package/package.json +1 -1
- package/dist/chunk-FKEKBZ3E.js.map +0 -1
- package/dist/chunk-PUXQGUMQ.js.map +0 -1
- package/dist/chunk-TGAU3WTF.js.map +0 -1
- package/dist/chunk-X6V2AKJL.js.map +0 -1
package/dist/serve.js
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
UPDATE_ENDPOINT,
|
|
13
13
|
startUpdateCheck
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YTEUMO3O.js";
|
|
15
15
|
import {
|
|
16
16
|
NOTES_ENDPOINT,
|
|
17
17
|
ensureFileIgnored,
|
|
18
18
|
notesResponse
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LXW6WFOC.js";
|
|
20
20
|
import "./chunk-A4DX2V4C.js";
|
|
21
21
|
|
|
22
22
|
// src/serve/index.ts
|
package/dist/server.js
CHANGED
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
readActive,
|
|
11
11
|
variantsResponse,
|
|
12
12
|
writeActive
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BRBXIGZP.js";
|
|
14
14
|
import {
|
|
15
15
|
VARIANTS_ENDPOINT
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RKZWO37H.js";
|
|
17
17
|
import {
|
|
18
18
|
NOTES_ENDPOINT,
|
|
19
19
|
PAYLOAD_MAX,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
readNotes,
|
|
23
23
|
updateNotes,
|
|
24
24
|
writeNotes
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LXW6WFOC.js";
|
|
26
26
|
import "./chunk-A4DX2V4C.js";
|
|
27
27
|
|
|
28
28
|
// src/server/index.ts
|
package/dist/vite-plugin.js
CHANGED
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
readNodeJson,
|
|
7
7
|
sendFailure
|
|
8
8
|
} from "./chunk-DDMHJ23I.js";
|
|
9
|
+
import {
|
|
10
|
+
isRouteModule,
|
|
11
|
+
scanExports
|
|
12
|
+
} from "./chunk-BDTB3DFR.js";
|
|
9
13
|
import {
|
|
10
14
|
ACTIVE_FILE,
|
|
11
15
|
listVariants,
|
|
@@ -17,21 +21,21 @@ import {
|
|
|
17
21
|
variantDir,
|
|
18
22
|
variantsDir,
|
|
19
23
|
variantsResponse
|
|
20
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BRBXIGZP.js";
|
|
21
25
|
import {
|
|
22
26
|
VARIANTS_ENDPOINT,
|
|
23
27
|
overlayGroups
|
|
24
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-RKZWO37H.js";
|
|
25
29
|
import {
|
|
26
30
|
UPDATE_ENDPOINT,
|
|
27
31
|
startUpdateCheck
|
|
28
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-YTEUMO3O.js";
|
|
29
33
|
import {
|
|
30
34
|
NOTES_ENDPOINT,
|
|
31
35
|
ensureDirIgnored,
|
|
32
36
|
ensureFileIgnored,
|
|
33
37
|
notesResponse
|
|
34
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-LXW6WFOC.js";
|
|
35
39
|
import "./chunk-A4DX2V4C.js";
|
|
36
40
|
|
|
37
41
|
// src/vite/index.ts
|
|
@@ -41,101 +45,6 @@ import {
|
|
|
41
45
|
normalizePath
|
|
42
46
|
} from "vite";
|
|
43
47
|
|
|
44
|
-
// src/vite/exports.ts
|
|
45
|
-
var ROUTE_EXPORTS = /* @__PURE__ */ new Set([
|
|
46
|
-
"loader",
|
|
47
|
-
"action",
|
|
48
|
-
"clientLoader",
|
|
49
|
-
"clientAction",
|
|
50
|
-
"headers",
|
|
51
|
-
"links",
|
|
52
|
-
"meta",
|
|
53
|
-
"handle",
|
|
54
|
-
"shouldRevalidate",
|
|
55
|
-
"middleware",
|
|
56
|
-
"clientMiddleware",
|
|
57
|
-
"unstable_middleware",
|
|
58
|
-
"unstable_clientMiddleware",
|
|
59
|
-
"HydrateFallback"
|
|
60
|
-
]);
|
|
61
|
-
var IDENT = /^[A-Za-z_$][\w$]*$/;
|
|
62
|
-
function scanExports(code) {
|
|
63
|
-
const names = /* @__PURE__ */ new Set();
|
|
64
|
-
const lines = code.split("\n");
|
|
65
|
-
for (let i = 0; i < lines.length; i++) {
|
|
66
|
-
const line = (lines[i] ?? "").replace(/^(?:\/\*.*?\*\/\s*)+/, "");
|
|
67
|
-
if (!line.startsWith("export")) continue;
|
|
68
|
-
const rest = line.slice("export".length);
|
|
69
|
-
if (rest !== "" && !/^[\s{*]/.test(rest)) continue;
|
|
70
|
-
const body = rest.trim();
|
|
71
|
-
if (body.startsWith("{") || body.startsWith("type {")) {
|
|
72
|
-
if (body.startsWith("type")) continue;
|
|
73
|
-
let clause = body;
|
|
74
|
-
while (!clause.includes("}") && i + 1 < lines.length) clause += ` ${lines[++i]}`;
|
|
75
|
-
const inner = clause.slice(clause.indexOf("{") + 1, clause.indexOf("}"));
|
|
76
|
-
for (const raw of inner.split(",")) {
|
|
77
|
-
const spec = raw.replace(/\/\/.*$/, "").trim();
|
|
78
|
-
if (!spec || spec.startsWith("type ")) continue;
|
|
79
|
-
const as = spec.split(/\s+as\s+/);
|
|
80
|
-
const name = (as[1] ?? as[0] ?? "").trim().replace(/^["']|["']$/g, "");
|
|
81
|
-
if (!name) return null;
|
|
82
|
-
names.add(name);
|
|
83
|
-
}
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (/^type\s*\*/.test(body)) continue;
|
|
87
|
-
const star = body.match(/^\*\s+as\s+([A-Za-z_$][\w$]*)/);
|
|
88
|
-
if (star?.[1]) {
|
|
89
|
-
names.add(star[1]);
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (body.startsWith("*")) return null;
|
|
93
|
-
if (/^default\b/.test(body)) {
|
|
94
|
-
names.add("default");
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
if (/^(?:declare\s|type\s|interface\s)/.test(body)) continue;
|
|
98
|
-
if (/^(?:=|import\s|namespace\s|module\s|as\s)/.test(body)) return null;
|
|
99
|
-
const decl = body.match(
|
|
100
|
-
/^(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)|^(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)|^(?:const\s+)?enum\s+([A-Za-z_$][\w$]*)/
|
|
101
|
-
);
|
|
102
|
-
const declared = decl?.[1] ?? decl?.[2] ?? decl?.[3];
|
|
103
|
-
if (declared) {
|
|
104
|
-
names.add(declared);
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
const variable = body.match(/^(?:const|let|var)\s+(.*)$/);
|
|
108
|
-
if (variable) {
|
|
109
|
-
const target = (variable[1] ?? "").trim();
|
|
110
|
-
if (target.startsWith("{") || target.startsWith("[")) return null;
|
|
111
|
-
const name = target.match(/^([A-Za-z_$][\w$]*)/)?.[1];
|
|
112
|
-
if (!name) return null;
|
|
113
|
-
if (hasSecondDeclarator(target)) return null;
|
|
114
|
-
names.add(name);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
for (const name of names) if (name !== "default" && !IDENT.test(name)) return null;
|
|
120
|
-
return [...names];
|
|
121
|
-
}
|
|
122
|
-
function isRouteModule(names) {
|
|
123
|
-
return names.includes("default") && names.some((name) => ROUTE_EXPORTS.has(name));
|
|
124
|
-
}
|
|
125
|
-
function hasSecondDeclarator(declaration) {
|
|
126
|
-
const text = declaration.replace(/\/\/.*$/, "").replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g, '""');
|
|
127
|
-
let depth = 0;
|
|
128
|
-
let initialized = false;
|
|
129
|
-
for (let i = 0; i < text.length; i++) {
|
|
130
|
-
const ch = text[i];
|
|
131
|
-
if (ch === "(" || ch === "[" || ch === "{" || ch === "<") depth++;
|
|
132
|
-
else if (ch === ")" || ch === "]" || ch === "}" || ch === ">" && text[i - 1] !== "=") depth = Math.max(0, depth - 1);
|
|
133
|
-
else if (depth === 0 && ch === "=" && text[i + 1] !== "=" && text[i + 1] !== ">" && text[i - 1] !== "=") initialized = true;
|
|
134
|
-
else if (depth === 0 && ch === "," && initialized) return true;
|
|
135
|
-
}
|
|
136
|
-
return depth === 0 && /,\s*$/.test(text);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
48
|
// src/vite/live.ts
|
|
140
49
|
var VERSION_QUERY = "isotone";
|
|
141
50
|
var BASE_VERSION = "_base";
|
|
@@ -768,20 +677,23 @@ function iteration(options = {}) {
|
|
|
768
677
|
if (variantsOptions) {
|
|
769
678
|
activeIds = readActive(vopts);
|
|
770
679
|
live = (variantsOptions.live ?? hasReact) && server.environments !== void 0;
|
|
771
|
-
const
|
|
680
|
+
const graphs = () => server.environments ? Object.values(server.environments).map((env) => env.moduleGraph) : [server.moduleGraph];
|
|
681
|
+
const covered = /* @__PURE__ */ new Set();
|
|
772
682
|
const signature = () => JSON.stringify(readManifests().map((v) => [v.id, v.group ?? "", Object.keys(v.files).sort()]));
|
|
773
|
-
let listed =
|
|
683
|
+
let listed = signature();
|
|
774
684
|
reloadPage = () => {
|
|
775
685
|
if (reloadTimer) clearTimeout(reloadTimer);
|
|
776
686
|
reloadTimer = setTimeout(() => {
|
|
777
687
|
reloadTimer = null;
|
|
778
|
-
const
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
688
|
+
const paths = /* @__PURE__ */ new Set([...dispatched.keys(), ...versionsByFile().keys(), ...covered]);
|
|
689
|
+
for (const graph of graphs()) {
|
|
690
|
+
for (const path of paths) {
|
|
691
|
+
for (const mod of graph.getModulesByFile(path) ?? []) graph.invalidateModule(mod);
|
|
692
|
+
}
|
|
693
|
+
const runtime = graph.getModuleById(RESOLVED_LIVE_MODULE);
|
|
694
|
+
if (runtime) graph.invalidateModule(runtime);
|
|
782
695
|
}
|
|
783
|
-
|
|
784
|
-
if (runtime) graph.invalidateModule(runtime);
|
|
696
|
+
covered.clear();
|
|
785
697
|
dispatched.clear();
|
|
786
698
|
server.ws.send({ type: "full-reload", path: "*" });
|
|
787
699
|
}, 50);
|
|
@@ -881,13 +793,17 @@ function iteration(options = {}) {
|
|
|
881
793
|
if (path === activeFile) {
|
|
882
794
|
void activate(readActive(vopts));
|
|
883
795
|
} else if (isInside(vDir, path)) {
|
|
796
|
+
for (const variant of manifests ?? []) {
|
|
797
|
+
for (const key of Object.keys(variant.files)) covered.add(normalizePath(join(vopts.root, key)));
|
|
798
|
+
}
|
|
884
799
|
forgetManifests();
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
800
|
+
const stillActive = readActive(vopts);
|
|
801
|
+
const activeChanged = stillActive.join() !== currentActive().join();
|
|
802
|
+
if (activeChanged) void activate(stillActive);
|
|
803
|
+
const now = signature();
|
|
804
|
+
if (now !== listed) {
|
|
805
|
+
listed = now;
|
|
806
|
+
if (live || activeChanged || stillActive.length > 0) reloadPage();
|
|
891
807
|
}
|
|
892
808
|
}
|
|
893
809
|
});
|