@barefootjs/xslate 0.31.3 → 0.31.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/dist/vite.js +100 -85
- package/lib/BarefootJS/Backend/Xslate.pm +1 -1
- package/package.json +5 -5
package/dist/vite.js
CHANGED
|
@@ -1948,6 +1948,20 @@ function templatePartsToJsExpr(parts, opts) {
|
|
|
1948
1948
|
return result;
|
|
1949
1949
|
}
|
|
1950
1950
|
|
|
1951
|
+
// ../jsx/src/identifier-pattern.ts
|
|
1952
|
+
function withUnicodeFlag(flags) {
|
|
1953
|
+
return flags.includes("u") ? flags : `${flags}u`;
|
|
1954
|
+
}
|
|
1955
|
+
function escapeIdentifierForRegex(name) {
|
|
1956
|
+
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1957
|
+
}
|
|
1958
|
+
var ID_BOUNDARY_BEFORE = "(?<![\\p{ID_Continue}$])";
|
|
1959
|
+
var ID_BOUNDARY_AFTER = "(?![\\p{ID_Continue}$])";
|
|
1960
|
+
function identifierPattern(name, flags = "") {
|
|
1961
|
+
const esc = escapeIdentifierForRegex(name);
|
|
1962
|
+
return new RegExp(`${ID_BOUNDARY_BEFORE}${esc}${ID_BOUNDARY_AFTER}`, withUnicodeFlag(flags));
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1951
1965
|
// ../jsx/src/scanner/js-scanner.ts
|
|
1952
1966
|
import ts2 from "typescript";
|
|
1953
1967
|
|
|
@@ -2065,6 +2079,83 @@ function derivesScopeFromSlot(comp) {
|
|
|
2065
2079
|
return comp.slotId != null && comp.loopItemRoot !== true;
|
|
2066
2080
|
}
|
|
2067
2081
|
|
|
2082
|
+
// ../jsx/src/scope/binding-scope.ts
|
|
2083
|
+
class BindingScope {
|
|
2084
|
+
frames;
|
|
2085
|
+
static EMPTY = new BindingScope([]);
|
|
2086
|
+
constructor(frames) {
|
|
2087
|
+
this.frames = frames;
|
|
2088
|
+
}
|
|
2089
|
+
enterLoopRow(loop) {
|
|
2090
|
+
const bindings = new Map;
|
|
2091
|
+
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
2092
|
+
for (const b of loop.paramBindings)
|
|
2093
|
+
bindings.set(b.name, { source: "destructure" });
|
|
2094
|
+
} else {
|
|
2095
|
+
bindings.set(loop.param, { source: "item" });
|
|
2096
|
+
}
|
|
2097
|
+
if (loop.index != null)
|
|
2098
|
+
bindings.set(loop.index, { source: "index" });
|
|
2099
|
+
for (const name of loop.preamble?.declaredNames ?? [])
|
|
2100
|
+
bindings.set(name, { source: "preamble" });
|
|
2101
|
+
const frame = { kind: "loop-row", bindings };
|
|
2102
|
+
return new BindingScope([frame, ...this.frames]);
|
|
2103
|
+
}
|
|
2104
|
+
enterCallback(params) {
|
|
2105
|
+
const bindings = new Map;
|
|
2106
|
+
for (const name of params)
|
|
2107
|
+
bindings.set(name, { source: "param" });
|
|
2108
|
+
const frame = { kind: "callback", bindings };
|
|
2109
|
+
return new BindingScope([frame, ...this.frames]);
|
|
2110
|
+
}
|
|
2111
|
+
isBound(name) {
|
|
2112
|
+
for (const frame of this.frames) {
|
|
2113
|
+
if (frame.bindings.has(name))
|
|
2114
|
+
return true;
|
|
2115
|
+
}
|
|
2116
|
+
return false;
|
|
2117
|
+
}
|
|
2118
|
+
lookup(name) {
|
|
2119
|
+
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
2120
|
+
const frame = this.frames[depth];
|
|
2121
|
+
const binding = frame.bindings.get(name);
|
|
2122
|
+
if (binding)
|
|
2123
|
+
return { depth, frame, binding };
|
|
2124
|
+
}
|
|
2125
|
+
return null;
|
|
2126
|
+
}
|
|
2127
|
+
boundNames() {
|
|
2128
|
+
if (this.boundNamesCache)
|
|
2129
|
+
return this.boundNamesCache;
|
|
2130
|
+
const names = new Set;
|
|
2131
|
+
for (const frame of this.frames) {
|
|
2132
|
+
for (const name of frame.bindings.keys())
|
|
2133
|
+
names.add(name);
|
|
2134
|
+
}
|
|
2135
|
+
this.boundNamesCache = names;
|
|
2136
|
+
return names;
|
|
2137
|
+
}
|
|
2138
|
+
boundNamesCache;
|
|
2139
|
+
valueBoundNamesCache;
|
|
2140
|
+
valueBoundNames() {
|
|
2141
|
+
if (this.valueBoundNamesCache)
|
|
2142
|
+
return this.valueBoundNamesCache;
|
|
2143
|
+
const names = new Set;
|
|
2144
|
+
for (const frame of this.frames) {
|
|
2145
|
+
for (const [name, binding] of frame.bindings) {
|
|
2146
|
+
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
2147
|
+
names.add(name);
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
this.valueBoundNamesCache = names;
|
|
2152
|
+
return names;
|
|
2153
|
+
}
|
|
2154
|
+
asShadowPredicate() {
|
|
2155
|
+
return (name) => this.isBound(name);
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2068
2159
|
// ../jsx/src/ir-to-client-js/html-template.ts
|
|
2069
2160
|
var VOID_ELEMENTS = new Set([
|
|
2070
2161
|
"area",
|
|
@@ -2499,7 +2590,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
2499
2590
|
const reachable = new Set;
|
|
2500
2591
|
const queue = [];
|
|
2501
2592
|
for (const name of allNames) {
|
|
2502
|
-
if (
|
|
2593
|
+
if (identifierPattern(name).test(primaryRefs)) {
|
|
2503
2594
|
reachable.add(name);
|
|
2504
2595
|
queue.push(name);
|
|
2505
2596
|
}
|
|
@@ -2508,7 +2599,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
2508
2599
|
const current = queue.shift();
|
|
2509
2600
|
const body = bodyMap.get(current) || "";
|
|
2510
2601
|
for (const name of allNames) {
|
|
2511
|
-
if (!reachable.has(name) &&
|
|
2602
|
+
if (!reachable.has(name) && identifierPattern(name).test(body)) {
|
|
2512
2603
|
reachable.add(name);
|
|
2513
2604
|
queue.push(name);
|
|
2514
2605
|
}
|
|
@@ -2839,83 +2930,6 @@ var toLocaleDatePlugin = {
|
|
|
2839
2930
|
}
|
|
2840
2931
|
};
|
|
2841
2932
|
|
|
2842
|
-
// ../jsx/src/scope/binding-scope.ts
|
|
2843
|
-
class BindingScope {
|
|
2844
|
-
frames;
|
|
2845
|
-
static EMPTY = new BindingScope([]);
|
|
2846
|
-
constructor(frames) {
|
|
2847
|
-
this.frames = frames;
|
|
2848
|
-
}
|
|
2849
|
-
enterLoopRow(loop) {
|
|
2850
|
-
const bindings = new Map;
|
|
2851
|
-
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
2852
|
-
for (const b of loop.paramBindings)
|
|
2853
|
-
bindings.set(b.name, { source: "destructure" });
|
|
2854
|
-
} else {
|
|
2855
|
-
bindings.set(loop.param, { source: "item" });
|
|
2856
|
-
}
|
|
2857
|
-
if (loop.index != null)
|
|
2858
|
-
bindings.set(loop.index, { source: "index" });
|
|
2859
|
-
for (const name of loop.preamble?.declaredNames ?? [])
|
|
2860
|
-
bindings.set(name, { source: "preamble" });
|
|
2861
|
-
const frame = { kind: "loop-row", bindings };
|
|
2862
|
-
return new BindingScope([frame, ...this.frames]);
|
|
2863
|
-
}
|
|
2864
|
-
enterCallback(params) {
|
|
2865
|
-
const bindings = new Map;
|
|
2866
|
-
for (const name of params)
|
|
2867
|
-
bindings.set(name, { source: "param" });
|
|
2868
|
-
const frame = { kind: "callback", bindings };
|
|
2869
|
-
return new BindingScope([frame, ...this.frames]);
|
|
2870
|
-
}
|
|
2871
|
-
isBound(name) {
|
|
2872
|
-
for (const frame of this.frames) {
|
|
2873
|
-
if (frame.bindings.has(name))
|
|
2874
|
-
return true;
|
|
2875
|
-
}
|
|
2876
|
-
return false;
|
|
2877
|
-
}
|
|
2878
|
-
lookup(name) {
|
|
2879
|
-
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
2880
|
-
const frame = this.frames[depth];
|
|
2881
|
-
const binding = frame.bindings.get(name);
|
|
2882
|
-
if (binding)
|
|
2883
|
-
return { depth, frame, binding };
|
|
2884
|
-
}
|
|
2885
|
-
return null;
|
|
2886
|
-
}
|
|
2887
|
-
boundNames() {
|
|
2888
|
-
if (this.boundNamesCache)
|
|
2889
|
-
return this.boundNamesCache;
|
|
2890
|
-
const names = new Set;
|
|
2891
|
-
for (const frame of this.frames) {
|
|
2892
|
-
for (const name of frame.bindings.keys())
|
|
2893
|
-
names.add(name);
|
|
2894
|
-
}
|
|
2895
|
-
this.boundNamesCache = names;
|
|
2896
|
-
return names;
|
|
2897
|
-
}
|
|
2898
|
-
boundNamesCache;
|
|
2899
|
-
valueBoundNamesCache;
|
|
2900
|
-
valueBoundNames() {
|
|
2901
|
-
if (this.valueBoundNamesCache)
|
|
2902
|
-
return this.valueBoundNamesCache;
|
|
2903
|
-
const names = new Set;
|
|
2904
|
-
for (const frame of this.frames) {
|
|
2905
|
-
for (const [name, binding] of frame.bindings) {
|
|
2906
|
-
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
2907
|
-
names.add(name);
|
|
2908
|
-
}
|
|
2909
|
-
}
|
|
2910
|
-
}
|
|
2911
|
-
this.valueBoundNamesCache = names;
|
|
2912
|
-
return names;
|
|
2913
|
-
}
|
|
2914
|
-
asShadowPredicate() {
|
|
2915
|
-
return (name) => this.isBound(name);
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
2933
|
// ../jsx/src/jsx-to-ir.ts
|
|
2920
2934
|
var EMPTY_BOUND = new Set;
|
|
2921
2935
|
var constInitializerCache = new WeakMap;
|
|
@@ -3941,7 +3955,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
3941
3955
|
lines.push(` const ${signal.getter} = () => ${initialValue}`);
|
|
3942
3956
|
}
|
|
3943
3957
|
if (signal.setter) {
|
|
3944
|
-
const setterUsed =
|
|
3958
|
+
const setterUsed = identifierPattern(signal.setter).test(setterRefText);
|
|
3945
3959
|
if (setterUsed) {
|
|
3946
3960
|
lines.push(` const ${signal.setter} = (..._args: any[]) => {}`);
|
|
3947
3961
|
}
|
|
@@ -4139,6 +4153,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
4139
4153
|
}
|
|
4140
4154
|
|
|
4141
4155
|
// ../jsx/src/adapters/template-imports.ts
|
|
4156
|
+
import ts25 from "typescript";
|
|
4142
4157
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
4143
4158
|
"@barefootjs/client",
|
|
4144
4159
|
"@barefootjs/client/runtime"
|
|
@@ -4902,7 +4917,7 @@ function dangerousInnerHtmlDiagnostic(expr, loc, reason) {
|
|
|
4902
4917
|
};
|
|
4903
4918
|
}
|
|
4904
4919
|
// ../jsx/src/combine-client-js.ts
|
|
4905
|
-
import
|
|
4920
|
+
import ts26 from "typescript";
|
|
4906
4921
|
// ../jsx/src/loop-destructure.ts
|
|
4907
4922
|
function isLowerableLoopDestructure(loop) {
|
|
4908
4923
|
const bindings = loop.paramBindings;
|
|
@@ -5042,9 +5057,9 @@ function escapeRe(s) {
|
|
|
5042
5057
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5043
5058
|
}
|
|
5044
5059
|
// ../jsx/src/debug.ts
|
|
5045
|
-
import ts26 from "typescript";
|
|
5046
|
-
// ../jsx/src/profiler.ts
|
|
5047
5060
|
import ts27 from "typescript";
|
|
5061
|
+
// ../jsx/src/profiler.ts
|
|
5062
|
+
import ts28 from "typescript";
|
|
5048
5063
|
|
|
5049
5064
|
// ../jsx/src/index.ts
|
|
5050
5065
|
registerBuiltinLoweringPlugins();
|
|
@@ -5815,7 +5830,7 @@ function collectImportedLoopChildComponentErrors(ir, componentName) {
|
|
|
5815
5830
|
}
|
|
5816
5831
|
|
|
5817
5832
|
// src/adapter/spread/spread-codegen.ts
|
|
5818
|
-
import
|
|
5833
|
+
import ts29 from "typescript";
|
|
5819
5834
|
function conditionalSpreadToKolon(ctx, expr) {
|
|
5820
5835
|
if (!expr || expr.kind !== "conditional")
|
|
5821
5836
|
return null;
|
|
@@ -5870,7 +5885,7 @@ function recordIndexAccessToKolon(ctx, val) {
|
|
|
5870
5885
|
if (val.kind !== "index-access" || val.object.kind !== "identifier" || val.index.kind !== "identifier") {
|
|
5871
5886
|
return null;
|
|
5872
5887
|
}
|
|
5873
|
-
const tsVal =
|
|
5888
|
+
const tsVal = ts29.factory.createElementAccessExpression(ts29.factory.createIdentifier(val.object.name), ts29.factory.createIdentifier(val.index.name));
|
|
5874
5889
|
const parsed = parseRecordIndexAccess(tsVal, ctx.localConstants ?? [], ctx.propsParams);
|
|
5875
5890
|
if (!parsed)
|
|
5876
5891
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/xslate",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.4",
|
|
4
4
|
"description": "Text::Xslate (Kolon) adapter for BarefootJS — compiles IR to .tx templates and ships the Xslate rendering backend; runs under any PSGI/Plack app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"directory": "packages/adapter-xslate"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@barefootjs/shared": "0.31.
|
|
58
|
+
"@barefootjs/shared": "0.31.4"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@barefootjs/jsx": ">=0.2.0",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
75
|
-
"@barefootjs/jsx": "0.31.
|
|
76
|
-
"@barefootjs/vite": "0.31.
|
|
77
|
-
"@barefootjs/client": "0.31.
|
|
75
|
+
"@barefootjs/jsx": "0.31.4",
|
|
76
|
+
"@barefootjs/vite": "0.31.4",
|
|
77
|
+
"@barefootjs/client": "0.31.4",
|
|
78
78
|
"typescript": "^5.0.0",
|
|
79
79
|
"vite": "^6.0.0"
|
|
80
80
|
}
|