@barefootjs/client 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/csr-adapter.js +98 -83
- package/package.json +2 -2
package/dist/csr-adapter.js
CHANGED
|
@@ -168861,6 +168861,20 @@ function templatePartsToJsExpr(parts, opts) {
|
|
|
168861
168861
|
return result;
|
|
168862
168862
|
}
|
|
168863
168863
|
|
|
168864
|
+
// ../jsx/src/identifier-pattern.ts
|
|
168865
|
+
function withUnicodeFlag(flags) {
|
|
168866
|
+
return flags.includes("u") ? flags : `${flags}u`;
|
|
168867
|
+
}
|
|
168868
|
+
function escapeIdentifierForRegex(name) {
|
|
168869
|
+
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
168870
|
+
}
|
|
168871
|
+
var ID_BOUNDARY_BEFORE = "(?<![\\p{ID_Continue}$])";
|
|
168872
|
+
var ID_BOUNDARY_AFTER = "(?![\\p{ID_Continue}$])";
|
|
168873
|
+
function identifierPattern(name, flags = "") {
|
|
168874
|
+
const esc = escapeIdentifierForRegex(name);
|
|
168875
|
+
return new RegExp(`${ID_BOUNDARY_BEFORE}${esc}${ID_BOUNDARY_AFTER}`, withUnicodeFlag(flags));
|
|
168876
|
+
}
|
|
168877
|
+
|
|
168864
168878
|
// ../jsx/src/scanner/js-scanner.ts
|
|
168865
168879
|
var import_typescript2 = __toESM(require_typescript(), 1);
|
|
168866
168880
|
|
|
@@ -168965,6 +168979,83 @@ function extractFreeIdentifiersFromText(text) {
|
|
|
168965
168979
|
return extractFreeIdentifiersFromNode(expr);
|
|
168966
168980
|
}
|
|
168967
168981
|
|
|
168982
|
+
// ../jsx/src/scope/binding-scope.ts
|
|
168983
|
+
class BindingScope {
|
|
168984
|
+
frames;
|
|
168985
|
+
static EMPTY = new BindingScope([]);
|
|
168986
|
+
constructor(frames) {
|
|
168987
|
+
this.frames = frames;
|
|
168988
|
+
}
|
|
168989
|
+
enterLoopRow(loop) {
|
|
168990
|
+
const bindings = new Map;
|
|
168991
|
+
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
168992
|
+
for (const b of loop.paramBindings)
|
|
168993
|
+
bindings.set(b.name, { source: "destructure" });
|
|
168994
|
+
} else {
|
|
168995
|
+
bindings.set(loop.param, { source: "item" });
|
|
168996
|
+
}
|
|
168997
|
+
if (loop.index != null)
|
|
168998
|
+
bindings.set(loop.index, { source: "index" });
|
|
168999
|
+
for (const name of loop.preamble?.declaredNames ?? [])
|
|
169000
|
+
bindings.set(name, { source: "preamble" });
|
|
169001
|
+
const frame = { kind: "loop-row", bindings };
|
|
169002
|
+
return new BindingScope([frame, ...this.frames]);
|
|
169003
|
+
}
|
|
169004
|
+
enterCallback(params) {
|
|
169005
|
+
const bindings = new Map;
|
|
169006
|
+
for (const name of params)
|
|
169007
|
+
bindings.set(name, { source: "param" });
|
|
169008
|
+
const frame = { kind: "callback", bindings };
|
|
169009
|
+
return new BindingScope([frame, ...this.frames]);
|
|
169010
|
+
}
|
|
169011
|
+
isBound(name) {
|
|
169012
|
+
for (const frame of this.frames) {
|
|
169013
|
+
if (frame.bindings.has(name))
|
|
169014
|
+
return true;
|
|
169015
|
+
}
|
|
169016
|
+
return false;
|
|
169017
|
+
}
|
|
169018
|
+
lookup(name) {
|
|
169019
|
+
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
169020
|
+
const frame = this.frames[depth];
|
|
169021
|
+
const binding = frame.bindings.get(name);
|
|
169022
|
+
if (binding)
|
|
169023
|
+
return { depth, frame, binding };
|
|
169024
|
+
}
|
|
169025
|
+
return null;
|
|
169026
|
+
}
|
|
169027
|
+
boundNames() {
|
|
169028
|
+
if (this.boundNamesCache)
|
|
169029
|
+
return this.boundNamesCache;
|
|
169030
|
+
const names = new Set;
|
|
169031
|
+
for (const frame of this.frames) {
|
|
169032
|
+
for (const name of frame.bindings.keys())
|
|
169033
|
+
names.add(name);
|
|
169034
|
+
}
|
|
169035
|
+
this.boundNamesCache = names;
|
|
169036
|
+
return names;
|
|
169037
|
+
}
|
|
169038
|
+
boundNamesCache;
|
|
169039
|
+
valueBoundNamesCache;
|
|
169040
|
+
valueBoundNames() {
|
|
169041
|
+
if (this.valueBoundNamesCache)
|
|
169042
|
+
return this.valueBoundNamesCache;
|
|
169043
|
+
const names = new Set;
|
|
169044
|
+
for (const frame of this.frames) {
|
|
169045
|
+
for (const [name, binding] of frame.bindings) {
|
|
169046
|
+
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
169047
|
+
names.add(name);
|
|
169048
|
+
}
|
|
169049
|
+
}
|
|
169050
|
+
}
|
|
169051
|
+
this.valueBoundNamesCache = names;
|
|
169052
|
+
return names;
|
|
169053
|
+
}
|
|
169054
|
+
asShadowPredicate() {
|
|
169055
|
+
return (name) => this.isBound(name);
|
|
169056
|
+
}
|
|
169057
|
+
}
|
|
169058
|
+
|
|
168968
169059
|
// ../jsx/src/ir-to-client-js/html-template.ts
|
|
168969
169060
|
var VOID_ELEMENTS = new Set([
|
|
168970
169061
|
"area",
|
|
@@ -169385,7 +169476,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
169385
169476
|
const reachable = new Set;
|
|
169386
169477
|
const queue = [];
|
|
169387
169478
|
for (const name of allNames) {
|
|
169388
|
-
if (
|
|
169479
|
+
if (identifierPattern(name).test(primaryRefs)) {
|
|
169389
169480
|
reachable.add(name);
|
|
169390
169481
|
queue.push(name);
|
|
169391
169482
|
}
|
|
@@ -169394,7 +169485,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
169394
169485
|
const current = queue.shift();
|
|
169395
169486
|
const body = bodyMap.get(current) || "";
|
|
169396
169487
|
for (const name of allNames) {
|
|
169397
|
-
if (!reachable.has(name) &&
|
|
169488
|
+
if (!reachable.has(name) && identifierPattern(name).test(body)) {
|
|
169398
169489
|
reachable.add(name);
|
|
169399
169490
|
queue.push(name);
|
|
169400
169491
|
}
|
|
@@ -169725,83 +169816,6 @@ var toLocaleDatePlugin = {
|
|
|
169725
169816
|
}
|
|
169726
169817
|
};
|
|
169727
169818
|
|
|
169728
|
-
// ../jsx/src/scope/binding-scope.ts
|
|
169729
|
-
class BindingScope {
|
|
169730
|
-
frames;
|
|
169731
|
-
static EMPTY = new BindingScope([]);
|
|
169732
|
-
constructor(frames) {
|
|
169733
|
-
this.frames = frames;
|
|
169734
|
-
}
|
|
169735
|
-
enterLoopRow(loop) {
|
|
169736
|
-
const bindings = new Map;
|
|
169737
|
-
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
169738
|
-
for (const b of loop.paramBindings)
|
|
169739
|
-
bindings.set(b.name, { source: "destructure" });
|
|
169740
|
-
} else {
|
|
169741
|
-
bindings.set(loop.param, { source: "item" });
|
|
169742
|
-
}
|
|
169743
|
-
if (loop.index != null)
|
|
169744
|
-
bindings.set(loop.index, { source: "index" });
|
|
169745
|
-
for (const name of loop.preamble?.declaredNames ?? [])
|
|
169746
|
-
bindings.set(name, { source: "preamble" });
|
|
169747
|
-
const frame = { kind: "loop-row", bindings };
|
|
169748
|
-
return new BindingScope([frame, ...this.frames]);
|
|
169749
|
-
}
|
|
169750
|
-
enterCallback(params) {
|
|
169751
|
-
const bindings = new Map;
|
|
169752
|
-
for (const name of params)
|
|
169753
|
-
bindings.set(name, { source: "param" });
|
|
169754
|
-
const frame = { kind: "callback", bindings };
|
|
169755
|
-
return new BindingScope([frame, ...this.frames]);
|
|
169756
|
-
}
|
|
169757
|
-
isBound(name) {
|
|
169758
|
-
for (const frame of this.frames) {
|
|
169759
|
-
if (frame.bindings.has(name))
|
|
169760
|
-
return true;
|
|
169761
|
-
}
|
|
169762
|
-
return false;
|
|
169763
|
-
}
|
|
169764
|
-
lookup(name) {
|
|
169765
|
-
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
169766
|
-
const frame = this.frames[depth];
|
|
169767
|
-
const binding = frame.bindings.get(name);
|
|
169768
|
-
if (binding)
|
|
169769
|
-
return { depth, frame, binding };
|
|
169770
|
-
}
|
|
169771
|
-
return null;
|
|
169772
|
-
}
|
|
169773
|
-
boundNames() {
|
|
169774
|
-
if (this.boundNamesCache)
|
|
169775
|
-
return this.boundNamesCache;
|
|
169776
|
-
const names = new Set;
|
|
169777
|
-
for (const frame of this.frames) {
|
|
169778
|
-
for (const name of frame.bindings.keys())
|
|
169779
|
-
names.add(name);
|
|
169780
|
-
}
|
|
169781
|
-
this.boundNamesCache = names;
|
|
169782
|
-
return names;
|
|
169783
|
-
}
|
|
169784
|
-
boundNamesCache;
|
|
169785
|
-
valueBoundNamesCache;
|
|
169786
|
-
valueBoundNames() {
|
|
169787
|
-
if (this.valueBoundNamesCache)
|
|
169788
|
-
return this.valueBoundNamesCache;
|
|
169789
|
-
const names = new Set;
|
|
169790
|
-
for (const frame of this.frames) {
|
|
169791
|
-
for (const [name, binding] of frame.bindings) {
|
|
169792
|
-
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
169793
|
-
names.add(name);
|
|
169794
|
-
}
|
|
169795
|
-
}
|
|
169796
|
-
}
|
|
169797
|
-
this.valueBoundNamesCache = names;
|
|
169798
|
-
return names;
|
|
169799
|
-
}
|
|
169800
|
-
asShadowPredicate() {
|
|
169801
|
-
return (name) => this.isBound(name);
|
|
169802
|
-
}
|
|
169803
|
-
}
|
|
169804
|
-
|
|
169805
169819
|
// ../jsx/src/jsx-to-ir.ts
|
|
169806
169820
|
var EMPTY_BOUND = new Set;
|
|
169807
169821
|
var constInitializerCache = new WeakMap;
|
|
@@ -170338,7 +170352,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
170338
170352
|
lines.push(` const ${signal.getter} = () => ${initialValue}`);
|
|
170339
170353
|
}
|
|
170340
170354
|
if (signal.setter) {
|
|
170341
|
-
const setterUsed =
|
|
170355
|
+
const setterUsed = identifierPattern(signal.setter).test(setterRefText);
|
|
170342
170356
|
if (setterUsed) {
|
|
170343
170357
|
lines.push(` const ${signal.setter} = (..._args: any[]) => {}`);
|
|
170344
170358
|
}
|
|
@@ -170536,6 +170550,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
170536
170550
|
}
|
|
170537
170551
|
|
|
170538
170552
|
// ../jsx/src/adapters/template-imports.ts
|
|
170553
|
+
var import_typescript25 = __toESM(require_typescript(), 1);
|
|
170539
170554
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
170540
170555
|
"@barefootjs/client",
|
|
170541
170556
|
"@barefootjs/client/runtime"
|
|
@@ -170925,11 +170940,11 @@ function registerBuiltinLoweringPlugins() {
|
|
|
170925
170940
|
registerLoweringPlugin(plugin);
|
|
170926
170941
|
}
|
|
170927
170942
|
// ../jsx/src/combine-client-js.ts
|
|
170928
|
-
var import_typescript25 = __toESM(require_typescript(), 1);
|
|
170929
|
-
// ../jsx/src/debug.ts
|
|
170930
170943
|
var import_typescript26 = __toESM(require_typescript(), 1);
|
|
170931
|
-
// ../jsx/src/
|
|
170944
|
+
// ../jsx/src/debug.ts
|
|
170932
170945
|
var import_typescript27 = __toESM(require_typescript(), 1);
|
|
170946
|
+
// ../jsx/src/profiler.ts
|
|
170947
|
+
var import_typescript28 = __toESM(require_typescript(), 1);
|
|
170933
170948
|
|
|
170934
170949
|
// ../jsx/src/index.ts
|
|
170935
170950
|
registerBuiltinLoweringPlugins();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/client",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.4",
|
|
4
4
|
"description": "BarefootJS client package: reactive primitives (SSR-safe) plus browser runtime under the `/runtime` subpath (compiler target)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"directory": "packages/client"
|
|
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"
|